Add ID or Class in each option of Datalist [duplicate]

▼魔方 西西 提交于 2020-01-26 04:39:04

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!