Element title Property - Change the title of a <p> element: - Javascript DOM

Javascript examples for DOM:Element title

Description

Element title Property - Change the title of a <p> element:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<p id="myP" title="Free Web tutorials">java2s.com</p>

<button onclick="myFunction()">Test</button>

<script>
function myFunction() {//from ww w.  ja va  2s  .  co  m
    document.getElementById("myP").title = "a title";
}
</script>

</body>
</html>

Related Tutorials