HTML DOM innerHTMLProperty
Definition and Usage
The innerHTML property sets or returns the HTML between the start and end tags of the table row.
Syntax
HTMLElementObject.innerHTML=text
Browser Support
![]()
![]()
![]()
![]()
![]()
All major browsers support the innerHTML property
Examples
Examples
Change text, URL, and link target:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Example Tutorial (example.com)</title>
<script>
function changeLink(){
document.getElementById('myAnchor').innerHTML="EXAMPLE";
document.getElementById('myAnchor').href="//www.example.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 Link">
</body>
</html>
Try it Yourself »
Other Extensions
Element Object