Preserve the original content within a placeholder script block as a reference (text/template is not recognized and will be disregarded).
<script id="dm" type="text/template">
<select>
<option value="">Select Quantity</option>
<option value="less ">50 - 60</option>
<option value="medium ">61 - 70</option>
<option value="large ">71 - 80</option>
<option value="xl ">Above 80</option>
</select>
</script>
Duplicate by executing:
var copy = $('#dm').html();
something.append(copy);
This prevents encountering issues with unique identifiers (since the select element has no ID). Moreover, it enhances readability and ease of maintenance.
Furthermore, if you intend to include this in a form, ensure that the select element is assigned a name:
var $copy = $($('#dm').html()).attr('name', newMenuName);
something.append(copy);
note: The additional $() method is used to convert the string into a DOM element before adding the attribute.