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

Popular posts from this blog

android - Spacing between the stars of a rating bar? -

aspxgridview - Devexpress grid - header filter does not work if column is initially hidden -

c# - How to execute a particular part of code asynchronously in a class -