Get your own website Result Size: 625 x 565
x
 
<!DOCTYPE html>
<html>
<body>
<h1>The Element Object</h1>
<h2>The title Property</h2>
<p>Hover over the 'w3schools.com' header (to see the title), before and after you click "Change".</p>
<h2 id="myH2" title="Free Web tutorials">w3schools.com</h2>
<button onclick="myFunction()">Change</button>
<script>
function myFunction() {
  const element = document.getElementById("myH2"); 
  element.title = "The World's Largest Web Development Site";
}
</script>
</body>
</html>