我用bPopup在jQuery plugin.link是:http://www.jqueryscript.net/lightbox/Lightweight-jQuery-Modal-Popup-Plugin-bPopup.html简单的jQuery模态弹出点击
这是一个按钮字段GridView的。
<asp:GridView ID="gvwData" runat="server"
AllowPaging="True" AutoGenerateColumns="False" >
<Columns>
<asp:TemplateField HeaderText="preview">
<ItemTemplate>
**<asp:Button id="mybutton" runat="server" Text="click"/>**
</ItemTemplate>
</asp:TemplateField>
</Columns>
<AlternatingRowStyle Width="220px" />
</asp:GridView>
这是JavaScript函数:
<script type="text/javascript">
$(document).on("click", "[id*=mybutton]", function(e) {
e.preventDefault();
**$('#elementtopopup').bPopup();**
}); (jQuery);
</script>
$( '#elementtopopup')bPopup()没有显示。以下是我收到的错误的屏幕截图。
Screenshot of the console error
是啊..我改变了这一点。同时我把所有与弹出(div,脚本)相关的代码放在页面的底部。替代使用我使用CssClass的按钮的ID,最后它的工作。感谢您的帮助.. :) – Malika
没问题,你能把它标记为回答吗? – kmcoulson