Home Web Front-end JS Tutorial setAttribute and class conflict resolution_javascript skills

setAttribute and class conflict resolution_javascript skills

May 16, 2016 pm 07:06 PM
class conflict

Suppose 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

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot Article Tags

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to use classes and methods in Python How to use classes and methods in Python Apr 21, 2023 pm 02:28 PM

How to use classes and methods in Python

Guide to uninstalling the NumPy library to avoid conflicts and errors Guide to uninstalling the NumPy library to avoid conflicts and errors Jan 26, 2024 am 10:22 AM

Guide to uninstalling the NumPy library to avoid conflicts and errors

Replace the class name of an element using jQuery Replace the class name of an element using jQuery Feb 24, 2024 pm 11:03 PM

Replace the class name of an element using jQuery

How to resolve Win11 wallpaper screen conflict How to resolve Win11 wallpaper screen conflict Jun 29, 2023 pm 01:35 PM

How to resolve Win11 wallpaper screen conflict

What does class mean in python? What does class mean in python? May 21, 2019 pm 05:10 PM

What does class mean in python?

How to resolve hotkey conflicts How to resolve hotkey conflicts Feb 23, 2024 am 08:12 AM

How to resolve hotkey conflicts

How SpringBoot encrypts and protects class files through custom classloader How SpringBoot encrypts and protects class files through custom classloader May 11, 2023 pm 09:07 PM

How SpringBoot encrypts and protects class files through custom classloader

Methods of predefined Class objects in java Methods of predefined Class objects in java Jul 01, 2023 pm 06:41 PM

Methods of predefined Class objects in java

See all articles