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

SAP Web Service from .NET via WCF -

Optimized Line drawing in QT -

datetime - str to time in python -