I have a form with a select box whose options are pre selected by ajax according to a previous value entered by the user.
I need to add text to these options pre selected ONLY.
for (i in data) {
$("#my_select_box_id").val(data[i][0]).attr('selected',true);
var id_option = data[i][0];
//this following line doesn't work, why do I do wrong here ?
$("#my_select_box_id option[value="id_option"]).html(data[i][1]);
}
"- see the colour coding of the problem line.