我有以下的jQuery代码的工作原理:
$(document).ready(function() {
$("input[id^='pos_']").change(UpdatePosition)
});
function UpdatePosition() {
var posVal = $(this).val();
var idArr = $(this).attr("id");
现在我想改变它,这样我可以使用其他领域的更新功能。到目前为止,我已经改变了它这样的:
$(document).ready(function() {
$("input[id^='pos_']").change(function() { update('Position'); })
});
function update(fld) {
var val = $(this).val();
var idArr = $(this).attr("id");
var propertyName = fld;
但现在我有一个问题,因为之前的函数中使用$(本)。现在,当我有我的通用功能 函数时,$(this)不再有效。我怎样才能将参考文件作为 参数更改为更新函数?