How would I simulate a click using Javascript or jquery?

Discussion in 'jQuery' started by SEOXpert2011, Jun 3, 2011.

  1. #1
    Hi All;

    Im looking for a way to have javascript or jquery do a mouse click on an object or a certain location. Can anyone help?

    Regards
    SEOX
     
    SEOXpert2011, Jun 3, 2011 IP
  2. Jan Novak

    Jan Novak Peon

    Messages:
    121
    Likes Received:
    5
    Best Answers:
    1
    Trophy Points:
    0
    #2
    Yes, you can simulate mouse click. Please could you provide more informations e.g. post a page and describe what is needed to do?
     
    Jan Novak, Jun 4, 2011 IP
  3. Cash Nebula

    Cash Nebula Peon

    Messages:
    1,197
    Likes Received:
    67
    Best Answers:
    0
    Trophy Points:
    0
    #3
    This also works in most browsers (not Mozilla/Filefox)
    document.getElementById('mydiv').click();

    Or you can use jQuery
    jQuery('#mydiv').click();

    To make it work on links, I think you need to add an onclick handler and then redirect the page.
     
    Last edited: Jul 16, 2011
    Cash Nebula, Jul 16, 2011 IP