问题
I'm looking for help with an issue I'm having, I'm new to html and have been searching for the answer.
I am trying to add a custom ID or Class to each of my options in my datalist, as of now i cant seem to work out how to do this. I am trying to do this to be able to open a specific popup for each selection but to do this i need to give them either an ID or Class to each option.
Any help would be appreciated.
Thanks!
<div class="form-group">
<input type="text" name="popup" id="popup"
list="category" placeholder="What service are you interested in">
<datalist id="category">
<option value="fitness" id="fitness"></option>
<option value="Boxing" id="boxing"></option>
<option value="Yoga" id="yoga"></option>
<option value="Mixed Martial Arts" id="mmma"></option>
</datalist>
</div>
来源:https://stackoverflow.com/questions/59804741/add-id-or-class-in-each-option-of-datalist