Depending on your circumstances, it may not be straightforward to generate unique or valid id's for your HTML elements. If you are looping over database records, you'd normally involve your records primary key in the ID attribute. But, if your primary key is not unique, or is not of a numeric datatype this method isn't as simple.
One of the most basic methods to deal with this is to use your scripting languages Base64 conversion function.
ColdFusion Example:
<cfoutput><label for="#ToBase64(primary_key_value & secondary_key_value)#">#option_label#</label></cfoutput>