在使用jQuery的网页加载自动点击按钮元素 [英] Auto-click button element on page load using jQuery

查看:562
本文介绍了在使用jQuery的网页加载自动点击按钮元素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我想在页面加载自动点击一个按钮元素,我将如何去了解这个使用jQuery?

If I wanted to auto-click a button element on page load, how would I go about this using jQuery?

按钮HTML是

<button class="md-trigger" id="modal" data-modal="modal"></button>

有关此主题的任何帮助将大大AP preciated!在此先感谢!

Any help on this topic would be greatly appreciated! Thanks in advance!

推荐答案

您只会使用jQuery像这样...

You would simply use jQuery like so...

<script>
jQuery(function(){
   jQuery('#modal').click();
});
</script>

使用点击功能,自动点击按钮#modal

Use the click function to auto-click the #modal button

这篇关于在使用jQuery的网页加载自动点击按钮元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆