css - Trying to chage UL LI backgroud color jquery -


i trying change clicked ul li link jquery; works hover event, not click event. please see code below:

$("nav ul li").hover(function() {     $(this).find('a').css('color', '#ff0'); }, function() {     $(this).find('a').css('color', '#fff'); });  $("nav ul li").click(function() {     $(this).find('a').css('color', '#ff0');     $(this).find('a').siblings().css('color', '#fff'); }); 

$(function() {                       //run when dom ready  $(".clickable").click(function() {  //use class, since id gets mangled   $(this).addclass("active");      //add class clicked element  }); }); 

using method can replace class new set of attributes on click.


Comments

Popular posts from this blog

Unable to remove the www from url on https using .htaccess -