0
我已經產生了錨狀JQuery用戶界面對話框,動態加載的URL
<a href="approvaledit.php?MSRID=<?php echo $MSRID; ?>" class="exampleLink" >Approval</a>
,我想打開與jQuery UI的對話approvaledit.php和我然而成功,因爲它們都具有相同的類名的所有生成的鏈接打開第一個href,這怎麼解決?
<a href="approvaledit.php?MSRID=<?php echo $MSRID; ?>" class="exampleLink" >Approval</a>
var $modalDialog = $('<div/>', {
'class': 'exampleModal',
'id': 'exampleModal1'
})
.appendTo('body')
.dialog({
dialogClass: 'my-extra-class',
resizable: true,
title:'PR Approval',
autoOpen: false,
width:'auto',
height:'auto',
show: 'fold',
position: { my: "right top", at: "top" },
modal: true,
close: function(event, ui) {
location.reload();
}
}).css("font-size", "11px");
$(function() {
$('a.exampleLink').on('click', function (e) {
e.preventDefault();
var url = $('a.exampleLink:first').attr('href');
$modalDialog.load(url, function(){
$('h4').hide(); $("#btnCancel").hide();
});
$modalDialog.dialog("open");
});
});
'var url = $(this).attr('href');'??? –
yess lol thnx mate – Hemin