How to change an HTML element content with onclick event in JavaScript

1 Answer

0 votes
<!doctype html>
<html>
<head>
</head>
<body>

<p id="id-p"></p>

<button onclick="document.getElementById('id-p').innerHTML=Date()">Click for time</button>
            
</body>
</html>

 



answered Sep 1, 2016 by avibootz
...