PRoblem with select null option
Posted
by Massimo Ugues
on Stack Overflow
See other posts from Stack Overflow
or by Massimo Ugues
Published on 2010-03-25T11:56:40Z
Indexed on
2010/03/25
12:03 UTC
Read the original article
Hit count: 488
Hallo all. I got a strange problem with this piece of code
Seleziona text 1 test 2
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
© Stack Overflow or respective owner