How JavaScript modifies div text
In this issue, the editor will bring you about how JavaScript modifies the div text. The article is rich in content and analyzes and narrates it from a professional point of view. I hope you can get something after reading this article.
JavaScript modifies div text: 1, use "document.getElementById ('id value')" statement to get div object according to the id value of div tag; 2, use "div object [xss_clean] =" new text content "statement to modify div text.
The operating environment of this tutorial: windows7 system, javascript1.8.5 version, Dell G3 computer.
The method of modifying div text by JavaScript
1. Get the div element object
Use getElementById () to get the object based on the id value
Document.getElementById ('div')
2. Modify the text content of the div tag
Div object [xss_clean] = "New div text content"
Complete implementation code:
For the old div text content, click to modify var div=document.getElementById ('div'); div.onclick = function () {/ / bind the event handler for the first list item, th [XSS _ clean] = "New div text content" } the above is the JavaScript shared by the editor on how to modify the div text. If you happen to have similar doubts, please refer to the above analysis to understand. If you want to know more about it, you are welcome to follow the industry information channel.