If I wanted to auto-click a button element on page load, how would I go about this using jQuery?
The button html is
<button class="md-trigger" id="modal" data-modal="modal"></button>
Any help on this topic would be greatly appreciated! Thanks in advance!
The click() is an inbuilt method in jQuery that starts the click event or attach a function to run when a click event occurs. Syntax: $(selector). click(function);
$("document"). ready(function() { $("ul. galleria li:first-child img"). trigger('click'); });
$(document). ready(function() { $('#titleee'). find('a'). trigger('click'); });
You would simply use jQuery like so...
<script> jQuery(function(){ jQuery('#modal').click(); }); </script>
Use the click function to auto-click the #modal button
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With