hi,
I have a combobox with values from a localstorage.
They are stored separated by ‘,’…. “proycontac”:”john smith,peter pan, the moon,”
i build a combobox with names and i want to get selected in the combobox those names that match ‘proycontac’ values.
-so i build the combobox with:
$('select[name="combobox1"]').append( new Option(nombre.fname + " " + nombre.lname) );
so the combobox displays john smith,peter pan,etc… correctly
-now i want to select only the names that match with ‘proycontac’ values.So
var summary3 = (elnombre.proycontac).split(",");
$.map(summary3, function(elem, i) {
$('select[name="combobox1"] option[text="' + elem + '"]').attr('selected', true);
});
But nothing gets selected, any help?