我有一个小的jquery脚本,当我在网格/表格(从webgrid构建)中单击ajax actionlink时,它将用旋转轮替换内容。它只是第一次工作。
$('#thisGrid tr td').click(function () {
$(this).html('<img src="@Url.Content("~/Content/ajax-loader.gif")" alt="Loading... Please Wait" style="height: 20px;"/>');
});
我还没有找到任何能让我确定为什么会这样的东西......对于为什么会发生这种情况的任何想法?
答案 0 :(得分:1)
可能尝试使用实时点击功能。
$('#thisGrid tr td').live('click', function(){ ...
答案 1 :(得分:0)
委派事件
$('#thisGrid').on('click','td' , function () {
$(this).html('<img src="@Url.Content("~/Content/ajax-loader.gif")"
alt="Loading... Please Wait" style="height: 20px;"/>');
});
更新适用于jQuery 1.6及以下版本
$('#thisGrid').delegate('td' , 'click', function () {
$(this).html('<img src="@Url.Content("~/Content/ajax-loader.gif")"
alt="Loading... Please Wait" style="height: 20px;"/>');
});