Please login to start chat

ICT Solutions 25 Jun 2022, 11:40:30
Category : JavaScript Tutorials

JS Event Listener 1

<!DOCTYPE html>
<html>
<head>
<title>JavaScript Code Testing</title>
</head>
<body>
<p id = "demo">The Date is:</p>
<button type = "button" id = "test">Show Date</button>&nbsp;&nbsp;
<button type = "button" id = "test1">Hide</button>
<script>
document.getElementById("test").addEventListener('click', jsFun);
document.getElementById("test1").addEventListener('click', jsHide);

function jsFun(){
document.getElementById("demo").innerHTML = Date();
}

function jsHide(){
document.getElementById("demo").innerHTML = "";
}

</script>
</body>
</html>

Comments:

No comment to show.

Available Services
Download Android Application