Assigning a unique ID would be the job of the template parser. You don’t mention which templating engine you’re using. The general idea is that you pass the dropdown data, along with a reference to the template you defined above, to the template parser. The parser will inject the id values into the correct template element and then you’re off to the races.