| | |
default "selected" option in firefox not working
Please support our HTML and CSS advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
Hey, I'm trying to use a simple select menu, and I would like to set one of the values to be the default, and it works great in IE, but not in firefox. Here is a sample:
Notice that I am trying to get "Test 3" to show up as the default option. It works fine in IE, but how do I get it to work in Firefox too?
HTML and CSS Syntax (Toggle Plain Text)
<select name="test"> <option value="Test 1">Test 1</option> <option value="Test 2">Test 2</option> <option value="Test 3" selected>Test 3</option> </select>
Notice that I am trying to get "Test 3" to show up as the default option. It works fine in IE, but how do I get it to work in Firefox too?
Last edited by nathanpacker; Jan 8th, 2007 at 7:33 pm.
Lol, well, I don't know enough to stay XHTML valid, but if I know it I will, so thanks for the info.
does it work in Firefox if you use one of those atttribute values instead of just 'selected'?
it's not so much a question of staying valid, as being compatible.
an absolutely 'correct' XML parser should reject that line of code and output a warning/error message instead of an expected output. But, Firefox only ever truely parses a page as X(HT)ML if you serve the Content-Type:application/xhtml+xml* header.
* not sure if that's the correct type, it's not an easy one to remember.
it's not so much a question of staying valid, as being compatible.
an absolutely 'correct' XML parser should reject that line of code and output a warning/error message instead of an expected output. But, Firefox only ever truely parses a page as X(HT)ML if you serve the Content-Type:application/xhtml+xml* header.
* not sure if that's the correct type, it's not an easy one to remember.
Plato forgot the nullahedron..
•
•
•
•
does it work in Firefox if you use one of those atttribute values instead of just 'selected'?
it's not so much a question of staying valid, as being compatible.
an absolutely 'correct' XML parser should reject that line of code and output a warning/error message instead of an expected output. But, Firefox only ever truely parses a page as X(HT)ML if you serve the Content-Type:application/xhtml+xml* header.
* not sure if that's the correct type, it's not an easy one to remember.
Ok, I just tried it again. And I realized when I said it was working before, it was because I was simply refreshing the page, but apparently Firefox retains all the information, so it didn't matter what had "selected" in the script, it was just selecting the one that was previously selected.
So I closed the window, opened a new one, and realized it wasn't working with just "selected" in the script. When i changed it to selected="yes", it worked.
Thanks.
So I closed the window, opened a new one, and realized it wasn't working with just "selected" in the script. When i changed it to selected="yes", it worked.
Thanks.
•
•
Join Date: Oct 2007
Posts: 38
Reputation:
Solved Threads: 1
Thanks a lot, would have spent hours trying to get it working if it wasn't for this thread.
The outcome: Firefox retains the last value you had a form field at when hitting refresh so to debug/test add "?1" or something similar to the URL to restart from afresh. Ctrl+Refresh doens't even work.
Next of all, 'SELECTED="yes"' worked in the end for me.
Thanks again!
The outcome: Firefox retains the last value you had a form field at when hitting refresh so to debug/test add "?1" or something similar to the URL to restart from afresh. Ctrl+Refresh doens't even work.
Next of all, 'SELECTED="yes"' worked in the end for me.
Thanks again!
![]() |
Similar Threads
- google "keyword" question (Search Engine Optimization)
- "res://" message in address bar, no pages can be displayed (Viruses, Spyware and other Nasties)
- yet another "hijackthis" log... (Viruses, Spyware and other Nasties)
- System 32 at startup and "dwn"/"down" pop up at startup (Viruses, Spyware and other Nasties)
Other Threads in the HTML and CSS Forum
- Previous Thread: Problem with table height in Internet Explorer
- Next Thread: Hit Count of HTML Pages using a text file
| Thread Tools | Search this Thread |
appointments asp background backgroundcolor beta browser bug calendar cart cgi code codeinjection corporateidentity css design development displayimageinsteadofflash dreamweaver emailmarketing epilepsy explorer firefox flash form format google griefers hackers hitcounter hover html ide ie7 ie8 iframe image images internet internetexplorer intranet iphone javascript jpeg layout macbook maps marketshare microsoft mozilla multimedia navigationbars news offshoreoutsourcingcompany opacity opera optimization pnginie6 positioning problem scroll seo shopping studio swf swf. textcolor timecolor titletags url urlseparatedwords visual visualization web webdevelopment webform website windows7






