I'm trying to populate a dropdown values using jquery.
<select class="browser-default" id="autopopulate" name="autopopulate">
</select>
I'm populating the names using this
var names = ['a','b','c']
for(let i=0;i<=names.length - 1;i++){
let d = names[i];
$("#autopopulate")
.append($("<option></option>")
.attr("value" ,d)
.text(d));
}
How to append values to existing names
var values = ['ab','bc','df']
For name 'a'
- value is 'ab'
.