javascript - Jquery Disable another input field based on focus or change of current field in a table -
i have got table has input fields in table rows. example:
<table> <tr> <td><input type="text" id="input1[1]" name="input1[1]" /></td><td><input type="text" id="input2[1]" name="input2[1]" /></td> </tr> <tr> <td><input type="text" id="input1[2]" name="input1[2]" /></td><td><input type="text" id="input2[2]" name="input2[2]" /></td> </tr> </table> if change or enter value in input1, has disable respective element of input2 of row likewise if enter value in input2 has disable input1 elemnt of row.
can please me in solving this. thanks.
edit: answers. can make condition based other field don't disable on values.
this disable other inputs in same row when value added input
$('td input').on('input', function() { $(this).closest('tr').find('input').not(this).prop('disabled', this.value.length) });
Comments
Post a Comment