Jquery,从点击获取url并传递到对话框中的确认按钮 [英] Jquery, get url from click and pass to confirm button in dialog
本文介绍了Jquery,从点击获取url并传递到对话框中的确认按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有这个jquery代码:
I have this jquery code:
$("#deletec-box").dialog({
autoOpen: false,
resizable: false,
height:230,
modal: true,
buttons: {
"Confirm": function() {
window.location = 'hrefurlfromclick';
$(this).dialog("close");
},
Cancel: function() {
$(this).dialog("close");
}
}
});
$("#deletec-confirm").click(function() {
$("#deletec-box").dialog("open");
return false;
});
然后在页面中有一个链接,调用对话框:
Then in the page I have a link that calls the dialog:
<a href="?action=delc&cid=2" id="deletec-confirm">Delete</a>
我的问题是如何获得href的值,如果人确认加载链接他们最初点击了?
My question is how do I get the value of href so if the person does confirm it loads the link they originally clicked?
推荐答案
您可以获得href属性: $('#deletec-confirm ').attr('href');
You can get the href attribute with: $('#deletec-confirm').attr('href');
您的代码现在如下:
$("#deletec-box").dialog({
autoOpen: false,
resizable: false,
height:230,
modal: true,
buttons: {
"Confirm": function() {
window.location = $('#deletec-confirm').attr('href');
$(this).dialog("close");
},
Cancel: function() {
$(this).dialog("close");
}
}
});
$("#deletec-confirm").click(function() {
$("#deletec-box").dialog("open");
return false;
});
这篇关于Jquery,从点击获取url并传递到对话框中的确认按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文