0

I basically have a web page and want to simulate clicks via console. I tried to do this via document.getElementById("myButtonId").click() But the element only supports clicks at its central location.

Is there a way to click this element?

  • "But the element only supports clicks at its central location." What does that actually mean? Is there code for the eventlistener hat shows this? – epascarello Sep 03 '20 at 15:00
  • > But the element only supports clicks at its central location. Sounds like the element is not actually clickable and you are sending the click to a wrapper (outer) element therefore the click won't propagate. Might be helpful if you share more context and your actual HTML and/or more relevant code – tehsis Sep 03 '20 at 15:02
  • 1
    Does this answer your question? [How to simulate a click by using x,y coordinates in JavaScript?](https://stackoverflow.com/questions/3277369/how-to-simulate-a-click-by-using-x-y-coordinates-in-javascript) – Heretic Monkey Sep 03 '20 at 15:06

1 Answers1

0

if you are using jquery your code must be:

$("#myButtonId").click(); or $("#myButtonId").trigger("click");