Lozeputten Lozeputten - 24 days ago 4x
HTML Question

Can javascript click a div?

Is it possible to make javascript click on a div when the div exists in the browser?

For example, the script could refresh a webpage until a div shows up (with content), and than if the div is clickable, let javascript click it (or just follow the link, if there is one).


using jquery . use $(window).load(); function which attach all event after body load all content in web page . see below code : here you can read document of load();

working example on fiddle

 <div id="yourDivId"></div>    

  $(window).load(function () {
    $(document).on('click',"#yourDivId",function () {
         // Some code here