触发事件无法在AJAX加载的HTML上工作
-
04-10-2019 - |
题
好吧,在您在此表中进行编辑之后,我在focusOut上创建了它,它假设使用更新的数据重新加载整个行,事实是触发事件在第一个加载后停止工作。
我当前使用此代码
$(function () {
$.ajaxSetup ({
cache: false
});
$("td input").focusout(function() {
var defval = $(this).attr('title');
var value = $(this).attr('value');
var column = $(this).closest('td').attr('class')
var user = $('input[type=hidden]').attr('value');
var row = $(this).closest('tr').attr('id')
if(defval == value){
var state = 'Good Standing.';
}else{
var state = 'Will update spread sheet...';
var loadUrl = "./ajax/update.php";
$('#'+row+'').load(loadUrl, {row: row, user: user, column: column, value: value});
}
});
});
这行现在看起来像这样
<tr class="numbers" id="3">
<td class="a" align="right">3</td>
<td class="b"><input class="input" type="text" title="1750" value="1750"/></td>
<td class="c"><input class="input" type="text" title="2100" value="2100"/></td>
<td class="d"><input class="input" type="text" title="0" value="0"/></td>
<td class="e"><input class="input" type="text" title="0" value="0"/></td>
<td class="f">3.5</td>
<td class="g"><input class="input" type="text" title="0" value="0"/></td>
</tr>
我得到的任何援助将不胜感激
问候
不隶属于 StackOverflow