setAttribute and class conflict resolution_javascript skills
May 16, 2016 pm 07:06 PMSuppose we want to use setAttribute to change a dom class, how should we write it?
1. setAttribute("class","red")
2. setAttribute("className","red")
The answer is:
Option 1. Use under firefox
Option 2. Use
under IE. If you setAttribute("class") to DOM under IE and use IE Developer to look at the structure, you will find that two classes are displayed on the DOM... It turns out that IE is the Custom classes are distinguished from system classes. - -b

Hot Article

Hot tools Tags

Hot Article

Hot Article Tags

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

How to use classes and methods in Python

Guide to uninstalling the NumPy library to avoid conflicts and errors

Replace the class name of an element using jQuery

How to resolve Win11 wallpaper screen conflict

How SpringBoot encrypts and protects class files through custom classloader

Methods of predefined Class objects in java
