我有一個問題,我無法解決儘管我讀到類似問題的所有可能的解決方案 我有一個ajax請求,在成功的情況下,添加dinamically到表 裏面,我必須放置一個顯示覆蓋窗口的鏈接。jquery:爲覆蓋窗口動態添加事件
這是HTML「靜態」代碼:
<tr valign="top" id="trc_0">
<td><strong><em>Principal Investigator</em></strong></td>
<td><span id="cName_0">Georg Wohlfahrt</span></td>
<td><span id="cInst_0">University of Innsbruck</span></td>
<td><span id="cMail_0">[email protected]</span></td>
<td><input type="checkbox" id="ifch_0" disabled="disabled" /></td>
<td><input type="checkbox" id="ibch_0" disabled="disabled" /></td>
<td><input type="checkbox" id="iach_0" disabled="disabled" /></td>
<td><a href='#' onclick='deleteColl(518,0);'>Delete</a> <a href="#" class='modalInput' rel='#pi_colls' id='edit_coll_0' onclick='collMe(0 , "A",518);' Edit</a></td>
</tr>
,這裏是jQuery代碼,增加了該行correclty插入的行
trToAdd="<tr id='trc_"+collToSend+"'><td>Collaborator</td>";
trToAdd+="<td><span id='cName_"+collToSend+"'>"+$("#collNamex").val()+"</span></td>";
trToAdd+="<td><span id='cInst_"+collToSend+"'>"+$("#collInstx").val()+"</span></td>";
trToAdd+="<td><span id='cMail_"+collToSend+"'>"+$("#collMailx").val()+"</span></td>";
trToAdd+="<td>"+inputF+"</td>";
trToAdd+="<td>"+inputB+"</td>";
trToAdd+="<td>"+inputA+"</td>";
trToAdd+="<td><a href='#' class='modalInput' rel='#pi_colls'>Edit</a></td>";
trToAdd+="</tr>";
$('#collTab tr:last').after(trToAdd);
,但事件應顯示覆蓋窗口不起作用
最後,我張貼HTML和JavaScript的Overaly:
<div class="modal" id="pi_colls">
<h2>This is a PI dialog</h2>
<table>
<tr><td>Coll type</td><td>PI: <input type="checkbox" id="pix" />Coll: <input type="checkbox" id="collx" /></td></tr>
<tr><td>Name</td><td><input type="text" id="collNamex" /></td></tr>
<tr><td>Institution</td><td><input type="text" id="collInstx" /></td></tr>
<tr><td>Mail</td><td><input type="text" id="collMailx" /></td></tr>
<tr><td>Type</td><td>Anc: <input type="checkbox" id="collAncx" />Bio: <input type="checkbox" id="collBiox" /><br />Flu:<input type="checkbox" id="collFlux" /></td> </tr>
</table>
<p>
<a href="#" class="close" onclick="saveColl();">Yes</a>
<a href="#" class="close">No</a>
</p>
</div>
$(document).ready(function() {
var triggers = $(".modalInput").overlay({
mask: {
color: '#ebecff',
loadSpeed: 200,
opacity: 0.9
},
closeOnClick: false
});
});
</script>
希望我已經清楚...任何人都可以幫助我嗎? 感謝名單 迭戈