Javascript Tutorial | Changing HTML Elements

preview_player
Показать описание
Javascript works hand in hand with the DOM as we know. So how about changing text and information within the DOM. Well we can easily do this by targeting an object that represents the DOM element in Javascript and modify the innerHTML or innerText properties.

Firstly I'll be changing the innerText property. The innerText property allows us to insert text into a DOM element that is visible to the user, if you try passing in HTML it'll escape all characters. However using the innerHTML property we can insert text and HTML as well. Now we can add child elements to the element in question.

Рекомендации по теме
Комментарии
Автор

can i do some thing like changing the tag by javascript like changing <p> this is conntent </p> to <h1> see i changed to heading </h1>
i want to apply it to change a button to input type attribute :- <button> NEXT</button> to <input type="submit">

sumitahar