HTMLElement innerHTML Property
HTMLElement Object
Definition and Usage
The innerHTML property sets or returns the inner HTML of an element.
Syntax
HTMLElementObject.innerHTML=text
Browser Support

The innerHTML property is supported in all major browsers.
Example
Example
Change the text, URL, and target of a link:
<html>
<head>
<script>
function changeLink()
{
document.getElementById('myAnchor').innerHTML="W3Schools";
document.getElementById('myAnchor').href="http://www.w3schools.com";
document.getElementById('myAnchor').target="_blank";
}
</script>
</head>
<body>
<a id="myAnchor" href="http://www.microsoft.com">Microsoft</a>
<input type="button" onclick="changeLink()" value="Change link">
</body>
</html>
Try it yourself »
HTMLElement Object
Thank You For Helping Us!
Your message has been sent to W3Schools.
Close [X]