jQuery 动态添加、删除css样式


1.addClass 

css中:

<style type="text/css">
       .chColor {background: #267cb7;color:white;
     }
   </style>

js中:

$("#nm_p").addClass("chColor"); // 追加样式

$("#nm_p").removeClass("chColor"); //移除

2.css

  $("#61dh a").hover(
function
(){
     $(this).css('color','#999');
  },
    function(){ 
     $(this).css('color','#123456');
});


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM