Thursday, April 30, 2015

mouseenter, mouseleave, and affecting every child but the first one in jQuery

$('#DummyData tr').not('#DummyData tr:first').bind('mouseenter', function () {
   $(this).attr('style', 'background-color: #FFFFCC; cursor: pointer;');
});
$('#DummyData tr').not('#DummyData tr:first').bind('mouseleave', function () {
   $(this).attr('style', 'background-color: #FFFFFF; cursor: pointer;');
});
$('#DummyData tr').not('#DummyData tr:first').bind('click', function () {

 
 

...this would be pretty good for making every row in an HTML table clickable and also highlightable upon mouseover save for the first as perhaps the first is used as a header instead of a data row.

No comments:

Post a Comment