首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >单击href之前显示的jquery ui / bootstrap对话框

问单击href之前显示的jquery ui / bootstrap对话框
EN

Stack Overflow用户
提问于 2019-12-29 04:01:09
回答 1查看 31关注 0票数 0

场景如下:

我有一堆<a href="X">元素,所以在重定向发生之前,我想等待一个引导模式/ jqueryui对话框(从未挖掘过,尽管我更喜欢使用引导模式)被确认或取消。我尝试过一种

代码语言:javascript
复制
$('a').on('click',function(){
   alert('!'); //this one of course happens before the redirect
   $( "#dialog-confirm" ).dialog({...}); //this one shows and is immediately redirected
});

我怎样才能满足我的需求呢?

EN

回答 1

Stack Overflow用户

发布于 2019-12-29 04:34:18

我是通过以下方式做到的:

代码语言:javascript
复制
$('.modal_before_click').on('click',function(e){

   redirect_after_modal =   $(this)[0]['href'];

   $('#modal_cancel_button').on('click',function(){window.location = redirect_after_modal;  });

   $('#modal_trigger_button').trigger('click');

   return false;
});
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/59514425

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档