このリンクがあり、クリックするとモーダルダイアログボックスが表示されます。
<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
とモーダルダイアログボックスが表示されますが、最初のリンク以外のリンクをクリックしてもボックスが表示されないのが気になります。私のコードの問題は何だと思われますか?ありがとう。