Home > Web Front-end > JS Tutorial > js method to assign values ​​to label tags and div tags

js method to assign values ​​to label tags and div tags

高洛峰
Release: 2016-12-29 09:12:46
Original
1566 people have browsed it

In html, label does not have a value attribute.
Like div and most other html elements, it has innerText and innerHTML attributes
Cannot document.getElementByID("test").value="chenhuang ";
should be the following

<labelid="test"></label>
document.getElementById(test).innerText="";
<divid="test"></label>
document.getElementById(&#39;test&#39;).innerHTML="";
Copy after login

For more js methods of assigning values ​​to label tags and div tags, please pay attention to the PHP Chinese website for related articles!


Related labels:
source:php.cn
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template