Home>Article>Web Front-end> How to remove CSS styles with JS/jQuery
Method: 1. Use js, the syntax "document.getElementById("id name").removeAttribute("style")"; 2. Use jQuery, the syntax "$("id name").removeAttr( "style","")".
The operating environment of this tutorial: windows7 system, javascript1.8.5&&jquery2.1.1 version, Dell G3 computer.
Sometimes it is necessary to add and remove CSS styles, such as adding the display attribute and setting it to hidden. Sometimes it is necessary to remove the display attribute.
JS/jQuery Add or remove CSS styles
//通过JS移除css样式 document.getElementById("tab1").removeAttribute("style"); //通过jQuery移除css样式 $("//m.sbmmt.com/m/faq/#tab1").removeAttr("style","");
Example
信息管理
张三
微信号:zhangsan
部门:安全部
[Recommended learning:javascript video tutorial]
The above is the detailed content of How to remove CSS styles with JS/jQuery. For more information, please follow other related articles on the PHP Chinese website!