views:

34

answers:

0

Hallo all. I got a strange problem with this piece of code

<select name="nazioni" id="nazioni">
  <option selected="selected" value="val">Seleziona</option>
  <option value="0">text 1</option>
  <option value="1">test 2</option>
</select>

The correct behaviour is that with this html the selected option is the "Seleziona" On some browser when i render this html the first option is blank and if I select the value jQuery("#nazioni").val() I got null value.

Where is the problem? With the select option in this state I cannot set any values via jquery or via any other plugin.

jQuery("#nazioni option:first").attr("selected", "selected"); does not work. I tried to use the textotela plugin (http://www.texotela.co.uk/code/jquery/select/) but if i remove the first option in this way jQuery("#nazioni).removeOption(0) it removes the "Seleziona" value.

Any idea?

Kind regards Massimo