I need to write a javascript code for my website.
What I wanna do is that when my website is fully loaded, the script will click automatically on a random point.
I don't know if it's possible or not, I need help.
Thanks in advance.
I need to write a javascript code for my website.
What I wanna do is that when my website is fully loaded, the script will click automatically on a random point.
I don't know if it's possible or not, I need help.
Thanks in advance.
You can't set the mouse position with JavaScript or jQuery. But you can click automatically on items.
You need to use jQuery to do that.
Because jQuery is designed for these purposes .
You can use $("#foo").trigger(clickEvent)
.
Here is an example:
$(document).ready(function() { // Is the page fully loaded?
var event = jQuery.Event("click");
$("#foo").trigger(event); //Click!
});
But to get a random number, you should use Math.random();