I have a button within a div which is hidden by default as it is used as a modal popup by jQuery UI.
The click event handler for this button never gets called, yet if I copy the button code outside of this hidden div then it works correctly. How do I get around this problem?
This is the code I have so far:
<div id="dialog" title="Notify Users">
<div style="width:100%; height:500px; overflow:auto;">
<asp:Repeater runat="server" ID="rptNotify">
<HeaderTemplate>
<table>
</HeaderTemplate>
<ItemTemplate>
<tr>
<td>
<asp:CheckBox ID="chkUser" runat="server" Checked='<%# Eval("Checked") %>' />
</td>
<td>
<asp:Label ID="lblUser" runat="server" Text='<%# Eval("FullName") %>'/>
</td>
</tr>
</ItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</asp:Repeater>
</div>
<asp:Button ID="btnSaveNotifications" runat="server" Text="Save" OnClick="btnSaveNotifications_Click" />
</div>
The code to show /hide this div is:
<script>
// Increase the default animation speed to exaggerate the effect
$.fx.speeds._default = 1000;
$(function () {
$("#dialog").dialog({
autoOpen: false,
show: "blind",
hide: "explode"
});
$("#opener").click(function () {
$("#dialog").dialog("open");
return false;
});
});
</script>
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…