How to use JavaScript inside HTML element

1 Answer

0 votes
<!DOCTYPE html>
<html>
<body>

<button type="button"
onclick="document.getElementById('dt').innerHTML = Date()">Click</button>

<p id="dt"></p>

</body>
</html> 

<!--
run:

Tue Dec 25 2018 08:49:10 GMT+0200 (Israel Standard Time)

-->

 



answered Dec 25, 2018 by avibootz
edited Dec 25, 2018 by avibootz
...