【发布时间】:2014-07-30 01:50:44
【问题描述】:
无论如何我可以结合这个:
$("tbody").on("keyup", "tr td:nth-child(2) input,td:nth-child(3) input,td:nth-child(4)",
function () {
$(this) //input
.closest("tr") //finds the row associated with the input
.find("td:first input") //returns the first cell
.val(this.value); //sets the text
});
$('select').on('change', function() {
$(this).closest("tr").find("td:first input").val( this.value );
});
对于select change 和keyup for input 仅适用于一个函数,例如:
$("tbody").on("input keyup select change", "tr td:nth-child(2) input,td:nth-child(3) input,td:nth-child(4)",
...
});
我也想像type=text 的第一个输入一样设置它:
$(this).closest("tr").find("td:first input[type="text"]").val( this.value );
但它不起作用。
【问题讨论】:
标签: jquery select input onchange onkeyup