我有這個鏈接,點擊時會出現一個模式對話框。Modal對話框僅在點擊第一個鏈接後顯示
<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
鏈接將出現在模式對話框,但如果我點擊任何鏈接除第一個鏈接外,該框不會出現。什麼似乎是我的代碼上的問題?謝謝。
thanks.this works。:) – 2012-08-16 18:51:56