I have got an HTML Form in which there is a drop down list:
<select id="DWl1">
<option value="">Please Select</option>
<option value="C2C">C2C</option>
<option value="Advance Search">Advance Search</option>
<option value="EIV">EIV</option>
<option value="EWS">EWS</option>
<option value="PSU">PSU</option>
</select>
I have got to use the same drop down list over and over in multiple forms on the same page.
Currently I have created this list with multiple different IDs, like DWl1
, Dwl2
, DWl3
ect.
Is there a way that I can use this drop down list again and again without having to create so many different IDs?
2
Answers
It sounds like you want to make many similar lists, perhaps dynamically. I think template literals will come in handy here.
For example,
GO HERE for some handy documentation on template literals.
To get you started, I would try something like this:
<template>
and add an id to it.Hit the Run Code Snippet button below, right-click one of the dropdowns, select Inspect, and see that each has the correct id.