0
<a href="javascript:__doPostBack('btnContinuePhone','')" class="button-hpo blue-button-23" id="btnContinuePhone" onclick="javascript:return ConfirmModalPopUp('phone');"><span>Next</span></a>

我想更改此按钮的 href 并在单击时删除。谁能告诉我如何在jquery中做到这一点?

4

3 回答 3

2

You can try something like this:

var el = $("#element");
if (el){
    el.unbind("click");
    el.attr("href", "newpage.htm");
}
于 2011-10-18T16:59:45.353 回答
1

这里附有一个演示:http: //jsfiddle.net/xavi3r/DQ4Sn/

$('#btnContinuePhone').click(function(){
   return false; 
});
$('#btnContinuePhone').attr('href','http://newurl.com');
于 2011-10-18T16:56:21.280 回答
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(); });
于 2011-10-18T16:59:18.743 回答