0

If a user chooses "saab" from the dropdown list. I would like to disable the row (except the dropdown list) and clear the text from content.

for example: User clicks on "saab" in the first row. I want to disable the first row (but he can keep choose another option from the dropdown) and clear the text from content.

till he chooses "Volvo" and I enable him the row.

<table>
  <tr>
    <th>A</th>
    <th>B</th>
    <th>C</th>
  </tr>
  <tr>
    <td><select name="cars" id="cars">
    <option value="volvo">Volvo</option>
    <option value="saab">Saab</option>
    </select></td>
    <td><input type="text" id="fname1" name="fname"></td>
    <td><input type="text" id="fname2" name="fname"></td>
  </tr>
  <tr>
    <td><select name="cars" id="cars">
    <option value="volvo">Volvo</option>
    <option value="saab">Saab</option>
    </select></td>
    <td><input type="text" id="fname3" name="fname"></td>
    <td><input type="text" id="fname4" name="fname"></td>
  </tr>
</table>

Thanks.

Maor
  • 9
  • 2
  • 2
    Which bit are you having difficulty with? Running code when the `select` value changes? Selecting the relevant row/inputs? Disable/enabling the inputs? – freedomn-m Aug 25 '21 at 16:19
  • I found this is related to yours. Just change the flow according to your need This might help you https://www.aspsnippets.com/demos/2864/ – DineshMsd Aug 25 '21 at 16:26
  • How to find elements in the clicked row: https://stackoverflow.com,/q/18750152, https://stackoverflow.com/q/12987000, https://stackoverflow.com/q/46300015 ... How to disable inputs: https://stackoverflow.com/q/1414365 ... – Don't Panic Aug 25 '21 at 20:40

1 Answers1

0

Use javascript to add the css style (or a class containing the css) pointer-events:none; as well as any other css you might want to the first row.