javascript - How to set Autoclick on all the buttons of a page? -


i using jquery , ajax performing action, need after loading complete page, code click on every button automatically.

i used following javascript code click buttons in end of page. not working.

<script type='text/javascript'>     document.getelementbyclassname('sub').click(); </script> 

structure of page code

[jquery] [php] [html] [javascript] 

i set buttons type "button", when set

type="submit"

the autoclick code work on first button, "button" type not working of them.

if click manually on buttons working properly.

please give suggestion. thank you.

youre using wrong function. elements plural in method.

document.getelementsbyclassname('sub');

additionally, calling click on nodelist not work. need loop through , call event on each index.

also, you're using jquery. ensure call happens after dom ready, wrap js $().ready().

last, use tools you've provided yourself, in case jquery, , select element way.

$(document).ready(function(){     $(".sub").click() }); 

Comments

Popular posts from this blog

apache - PHP Soap issue while content length is larger -

asynchronous - Python asyncio task got bad yield -

javascript - Complete OpenIDConnect auth when requesting via Ajax -