why doesnt it stay highlighted in jQuery? -
i have jquery
$(function() { $('.count_links').hover( function(){ $(this).addclass("highlight"); }, function(){ $(this).removeclass("highlight"); }); $('.count_links').click(function(){ $('.count_links').not(this).removeclass('highlight'); $(this).addclass("highlight"); }); });
but link class never stays after clicked
i want hover effect , click effect
you're removing highlight
class when cursor leaves element.
it doesn't matter whether add class on click or on hover, second function passed .hover
(which called on mouse-out) removes class.
you might consider adding different class on click, 'selected'.
Comments
Post a Comment