Home  >  Article  >  Web Front-end  >  js innerHTML method to change div content_javascript skills

js innerHTML method to change div content_javascript skills

WBOY
WBOYOriginal
2016-05-16 17:26:571440browse

Changing the text innerHTML
Every HTML element has the InnerHtml attribute that defines the text that occurs between the HTML code and the element's opening and closing tags. By changing an element's innerHTML after some user interaction, you can make your web page more interactive.
However, using innerHTML requires some preparation if you want to be able to take advantage of it easily and reliably. First, you must give the ID card that you want to change. With the identifier in place, you will be able to use the getElementById function, which works in all browsers.
After you think about establishing the elements you can now manipulate the text. To get started, let's try changing the text to a bold marker.
Let’s take a look at using innerHTML of js to change the div value.

Copy the code The code is as follows:


Welcome to the site dude



Statement:
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