Friday, 23 August 2013

Javascript add class on click

Javascript add class on click

I am trying to add class to a link when it is clicked
Here is the code
jQuery(document).ready(function(){
jQuery('#block-block-23 li a').click(function() {
jQuery('#block-block-23 li a').addClass("selected");
});
});
and the problem is The class is adding when clicking the link but when the
page loads it is automatically gets removed.i have tried the toggleClass()
function also

No comments:

Post a Comment