When i use the following jQuery there is something wierd:
$("input[name*=RELATIVE_symbol]").live("focusout", function(){
var fieldNum = $(this).attr('id').replace("RELATIVE_symbol_","");
var newVal= $(this).val();
if (newVal !="") {
$("#SelectGroup option[value='"+fieldNum+"']").text(newVal);
$("#SelectGroupMargin option[value='"+fieldNum+"']").text(newVal);
}
});
where SelectGroup and #SelectGroupMargin are (select type in html)
at the end of its running, the first option in the comboboxes are selected automatically.
How can i make sure that nothing will be shown at the combobox and no option will be selected? I.e. why it is going to the first element automatically.
Thanks
This isn’t possible. If you do not stipulate a
selecteditem, then the first option will be selected by default.The way around this is to have an empty option at the top of your options.
If your worried about the first item actually being chosen then you can add some validation in to prevent it.