Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

set onclick javascript

<button id="myBtn">Try it</button>
<p id="demo"></p>

<script>
document.getElementById("myBtn").onclick=function(){displayDate()};

function displayDate()
{
    document.getElementById("demo").innerHTML=Date();
}
</script>
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #set #onclick #javascript
ADD COMMENT
Topic
Name
6+9 =