how to do click event in js code example
Example 1: javascript click event
<button onclick="myFunction()">Click me</button>
<p id="demo"></p>
<script>
function myFunction() {
document.getElementById("demo").innerHTML = "Hello World";
}
</script>
Example 2: how to create click function in javascript
var x = document.getElementById('container');
//click can also be antother event
x.addEventListener('click', function (x) {
console.log('hi');
});