-1

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.

1

1 Answer 1

0

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();

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.