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

js innerHTML method to change div content_javascript skills

WBOY
Release: 2016-05-16 17:26:57
Original
1503 people have browsed it

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



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