Jquery method to delete css styles: 1. Use removeattr() to remove all styles, the syntax format is "removeattr("style")"; 2. Use css() to remove a single style, the syntax format is "css ("Attributes","")".
The operating environment of this tutorial: windows7 system, jquery1.10.0 version, Dell G3 computer.
jquery delete css style
1. To remove all styles, use removeattr("style")
;
2. To remove a single style use css("property","")
;
For example:
<script type="text/javascript"> $(function(){ $("li").mouseover(function(){ //添加css样式 $(this).css("background","#ffdd00"); }); $("li").mouseout(function(){ //移出css样式 $(this).css("background",""); }); }); </script>
Recommended related tutorials:jQuery tutorial
The above is the detailed content of How to delete css style in jquery. For more information, please follow other related articles on the PHP Chinese website!