#How to remove css attributes in js?
At work, I often need to use Javascript to change the style of page elements. One way is to change the CSS class (Class) of the page element. In traditional Javascript, we usually do this by processing the classname attribute of HTML Dom. We can also remove css styles through this method.
JavaScript method to remove css attributes:
Use document.getElementById("objid").className="" to clear the style;
className attribute sets or returns the class attribute of the element. You can change the css style more by changing the class attribute.
In some browsers (such as Chrome), whatever value you assign to it will be returned. In IE, it is more painful. It will format the output, capitalize attributes, change the order of attributes, and remove the last semicolon
Example:
信息管理
Related recommendations:JS tutorial
The above is the detailed content of How to remove css attributes in js. For more information, please follow other related articles on the PHP Chinese website!