After searching extensively, I couldn't find a solution to my specific issue. In my form, I have a field for a date and another one for the number of hours. What I need is a Javascript function that, when clicked, will check if the date field is empty and if so, automatically clear out the value in the adjacent text box.
This is how part of my form code appears:
<td>Day One:</td>
<td width="250"><input type="date" name="dayone" onClick="document.getElementsByName('hours1')[0].value=8;" /></td>
<td>Hours: (max 8) <input type="text" name="hours1" id="hours1" class="smalltext" ></td>
The onclick event currently fills the adjacent text field with '8' as a default value. I require assistance in implementing a feature that will revert this value to blank if the user removes the date from the other field.
Your help is greatly appreciated!