<a href="javascript:__doPostBack('btnContinuePhone','')" class="button-hpo blue-button-23" id="btnContinuePhone" onclick="javascript:return ConfirmModalPopUp('phone');"><span>Next</span></a>
我想更改此按钮的 href 并在单击时删除。谁能告诉我如何在jquery中做到这一点?
<a href="javascript:__doPostBack('btnContinuePhone','')" class="button-hpo blue-button-23" id="btnContinuePhone" onclick="javascript:return ConfirmModalPopUp('phone');"><span>Next</span></a>
我想更改此按钮的 href 并在单击时删除。谁能告诉我如何在jquery中做到这一点?
You can try something like this:
var el = $("#element");
if (el){
el.unbind("click");
el.attr("href", "newpage.htm");
}
这里附有一个演示:http: //jsfiddle.net/xavi3r/DQ4Sn/
$('#btnContinuePhone').click(function(){
return false;
});
$('#btnContinuePhone').attr('href','http://newurl.com');
这是我的解决方案:
$('#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(); });