HTML DOM innerHTML property
Definition and Usage
The innerHTML property sets or returns the HTML between the start and end tags of a table row.
Syntax
HTMLElementObject.innerHTML=
text
Browser support





All major browsers support the innerHTML property
Example
Example
Change the text, URL, and link target:
<
!
DOCTYPE
html
<
html
<
head
<
meta
charset
=
"
utf-8
"
<
title
Runoob Tutorial(runoob.com)
title
<
script
function changeLink(){ document.getElementById('myAnchor').innerHTML="RUNOOB"; document.getElementById('myAnchor').href="//www.runoob.com"; document.getElementById('myAnchor').target="_blank"; }
script
head
<
body
<
a
id
=
"
myAnchor
"
href
=
"
//www.microsoft.com
"
Microsoft
a
<
input
type
=
"
button
"
onclick
=
"
changeLink()
"
value
=
"
Modify the link
"
body
html
Try it »
Element object