Select array, enable date field based on selected option

I have the following html

<table>
<tr>
<td><input type="button" onclick("addRow();")</td>
<td>
<select name="Category[]" onchange="enableDate();">
<option value="Category" Selected>Category</option>
<option value="1">1</option>
<option value="2">2</option>
</select>
</td>
<td><input type="date" name="Date[]" disabled></td>
</tr>
</table>

Clicking button adds a new row, different select options. If the user selects an option other than the selected default, the associated date field is enabled. How do I determine which select the selected index/value is in, so it enables the correct date field? There is a similar question Enable form element based on

You can pass the event information to the function, such as:

<select name="Category[]" onchange="enableDate(event);">

so that from the enableDate() function, you can retrieve the target element:

function enableDate(evt) {
  var select = evt.target;
  ...
}

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.