<a href="javascript:__doPostBack('btnContinuePhone','')" class="button-hpo blue-button-23" id="btnContinuePhone" onclick="javascript:return ConfirmModalPopUp('phone');"><span>Next</span></a>
我想更改此按钮的href并在点击时删除。有谁能告诉我如何在jquery中做到这一点?
答案 0 :(得分:2)
您可以尝试这样的事情:
var el = $("#element");
if (el){
el.unbind("click");
el.attr("href", "newpage.htm");
}
答案 1 :(得分:1)
这是一个附带的演示:http://jsfiddle.net/xavi3r/DQ4Sn/
$('#btnContinuePhone').click(function(){
return false;
});
$('#btnContinuePhone').attr('href','http://newurl.com');
答案 2 :(得分:0)
这是我的解决方案:
$('#btnContinuePhone').attr('href', 'what ever you like');
$('#btnContinuePhone').click(function(){ return false;});
或者你可以选择性地做到这一点:
$('#btnContinuePhone').attr('href', 'what ever you like');
$('#btnContinuePhone').click(function(e){ e.preventDefault(); });