i have question. can use id , class in body? use them 1 control in jquery next removeclass , addclass.
$('#example2').hover( function() { $(this).removeclass('example2'); $(this).addclass('example3'); }, function () { $(this).removeclass('example3'); $(this).addclass('example2'); } );
thank every answer!
sure can use id on body or virtually tag including script tags, style tags, meta tags...
can simplify hover bit using toggleclass()
$('#example2').hover(function() { $(this).toggleclass('example2 example3'); });
note need 1 of these on element start.
hover()
1 function argument work in both directions ... in , out. toggleclass()
add or removing depending on current state
Comments
Post a Comment