如何调用一个按钮的onclick事件A HREF? [英] How to call a href by onclick event of a button?

查看:136
本文介绍了如何调用一个按钮的onclick事件A HREF?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有如下的 A HREF 我用开的jQuery的对话框中,工作正常。基本上,openDialog类附上了jQuery的对话框code:

I have the following a href I use to open jquery dialogs, which works fine. Basically, the openDialog class has attached the jquery dialog code:

 <a class='openDialog' data-dialog-id='myEditDlg' data-dialog-autosize='false' data-dialog-alt='580' data-dialog-larg='740' data-dialog-title='test dialog' href='/mycontroller/EditDlg/myid'></a>

现在,我想用一个按钮的onclick 事件来调用它。
基本上,我想有点击的相同的行为&LT;一类='openDialogHREF 当我点击一个按钮。我该怎么办呢?**

Now, I'd like to call it by the onclick event of a button. Basically, I'd like to have the same behaviour of the clicked <a class='openDialog' href when I click a button. How can I do it?**

推荐答案

如果我得到你的问题的权利则可能是jQuery的的触发器()(?)是你在找什么。
例如:

If I get you question right then may be jQuery trigger()(?) is what you are looking for. Example:

<button id="bt">Click</button>
<a href="example.com" id="ex">Triggerable link</a>

<script type="text/javascript">
  $('#bt').click(function() {
       $('#ex').click();
  });
</script>

这篇关于如何调用一个按钮的onclick事件A HREF?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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