I have this search bar:
I dont want user to make a full search because there are like 40000 records on database and it will take a while.
So I split that in 2 options and I have the first field as required,
<select required name="field1" id="destination" tabindex="-1" class="select2-hidden-accessible" aria-hidden="true">
<option name="country" value="">Field</option>
<option name="country" value="%">Any destination</option>
</select>
But I need to remove that required field if they choose Field 2 or Field 3.
So I think best practice is to do something like onchange
and remove that required with something like this .removeAttribute("required")
?
Whats the easiest way to do that? Vanilla or JQuery? I am a beginner on JavaScript so any feedback would be helpful.