Answers for "how to click with javascript"

0

javascript click button by id

var button = document.getElementById("button");
button.click();
Posted by: Guest on May-20-2020
9

javascript click event

<button onclick="myFunction()">Click me</button>

<p id="demo"></p>

<script>
function myFunction() {
  document.getElementById("demo").innerHTML = "Hello World";
}
</script>
Posted by: Guest on April-10-2020
-1

javascript perform click

function eventFire(el, etype){
  if (el.fireEvent) {
    el.fireEvent('on' + etype);
  } else {
    var evObj = document.createEvent('Events');
    evObj.initEvent(etype, true, false);
    el.dispatchEvent(evObj);
  }
}
Posted by: Guest on May-06-2020
-1

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');
});
Posted by: Guest on February-21-2021

Code answers related to "how to click with javascript"

Browse Popular Code Answers by Language