lundi 29 décembre 2014

Custom javascript changes are overwritten by default javascript



I tried changing the background color of the left navigation list items when an item is clicked.When its clicked,it shows the effect but when the content in the page layout loads,the color is changed to some other color which I believe is happening because of the default javascript.Following is the code



$( function() {
$('.static a').click(function(){
$(this).css("background","black");
});
});


Note: class name of the left nav list items is 'static' and 'a' has the navigation link of the list item,when an item is clicked its class name changes to 'static selected'. How to make the javascript changes stay still once an item is clicked.








0 commentaires:

Enregistrer un commentaire