在加载时触发单击功能 [英] Trigger click function on load

查看:56
本文介绍了在加载时触发单击功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下功能,点击时激活:

I have the following function which is activated on click:

$('.results .view-rooms').click(function(){   }

无论如何我可以在文档加载时触发此功能吗?

Is there anyway I can trigger this function on document load?

推荐答案

是。

$(document).ready(function(){ // on document ready
    $(".results .view-rooms").click(); // click the element
})

这篇关于在加载时触发单击功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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