我有这个链接,点击它时会出现一个模式对话框。
<a href="#" id="addtoteam">
Add to Team
</a>
这是点击链接后会出现的对话框,
$('#addtoteam').click(function(event){
event.preventDefault();
var url = '<?php echo BASEURL;?>';
var teamID = '<?php echo $_SESSION['User']['Team']['id']?>';
var playerID = $(this).attr('player-id');
$( "#dialogbox" ).dialog({
autoOpen: true,
buttons: {
"Use Registration Credits": function(){
// execute something here before redirecting it to another page, perhaps perform the updating of the registration_credits of each team here
window.location = url + '/administration/add_to_team/' + playerID +'/'+ teamID +'/?credit=1';
},
"Pay Extra Charge": function() {
//$(this).dialog("close");
window.location = url + '/administration/add_to_team/' + playerID +'/'+ teamID +'/?proceed=1';
},
"Cancel": function() { $(this).dialog("close"); }
},
width: 800
});
});
现在这是可行的,但它只适用于第一个链接。你看我的链接是一个列表,每一行都有一个看起来像这样的链接,
`abc| def| ghi| Add to Teamlink`
`123| 456" 789| Add to Team link` and so on.
困扰我的是,当我单击abc| def| ghi| Add to Team link
链接时,会出现模式对话框,但如果我单击第一个链接以外的任何链接,则不会出现该框。我的代码似乎有什么问题?谢谢。