JQuery-Selector $(this).next("input[name='foo']") doesn't work -
i want react .change()
on value change. case, other (hidden) field must updated.
<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) { // testing alert("not found "+e); } try { $temp = $(this).next("input[name='h1']"); } catch (e) { { // testing alert("not found "+e); } $temp.val("hidden"); alert("temp "+$temp); alert("temp has following value:"+$temp.val()); }) </script>
demo testing at: http://jsfiddle.net/22c2n/1209/
this statement
$temp = $(this).next("input[type='hidden']");
results in "not defined", or better: $temp $object[] , not (as aspected) $object[input name='h1']
where problem?
Comments
Post a Comment