.change()
値の変更に対応したい。その場合、他の (隠し) フィールドを更新する必要があります。
<input type="text" name="n1"><br>
<input type="text" name="n2"><br>
<input type="text" name="n3"><br>
<input type="hidden" name="h1"><br>
<script>
$("input[type='text']").change( function() {
try {
$temp = $(this).next("input[type='hidden']");
} catch (e) { // just for testing
alert("not found "+e);
}
try {
$temp = $(this).next("input[name='h1']");
} catch (e) { { // just for testing
alert("not found "+e);
}
$temp.val("hidden");
alert("Temp is a "+$temp);
alert("Temp has following value:"+$temp.val());
})
</script>
テスト用のデモ: http://jsfiddle.net/22C2n/1209/
この文
$temp = $(this).next("input[type='hidden']");
「定義されていません」、またはそれ以上の結果になります: $temp は $object[] であり、(アスペクトとして) $object[ input name='h1']ではありません
問題はどこだ?