Html option selected attribute value

Html option selected attribute value

Author: Samuray On: 11.06.2017

Opened 6 years ago. Closed 6 years ago. Last modified 3 years ago.

selected » HTML Elements| Learn HTML | Tags | Tutorials | HTML Cheat Sheet

I am using Ubuntu None of those is selected manually i. You can check it yourself with following w3c validated little code:. This disappearing of a selected value happens in Google Chrome 8.

You see, pretty new browsers.

NetFind

So I can't really tell if I got the newest one, it's a confusing name scheme. This behaviour, however, does not appear in Firefox 3. I think that the way Firefox, Opera and IE handle this is the correct way. Could you please check if this is a bug in WebKit?

I looked into this and as Alexey Proskuryakov on the webkit bug tracker already pointed out this isn't an issue with removeAttr directly but with WebKit acting strange differntly when you set the selected property of a DOM option element to false or "". Why does jQuery do jQuery. This was already done in December and has been in jQuery since version 1.

You can also check out the still active test case link in the original ticket. I don't think so.

html option selected attribute value

This can also be triggered in WebKit without the use of jQuery by plain javascript. The code also isn't artificial but a legitimate use case. Both test cases show the same behavior in WebKit. On opening the page the correct option element is shown preselected. After clicking the button no option is shown as selected and the selectedIndex property of the parent select return That is a though call.

You could argue that having no option shown selected and selectedIndex set to -1 is a correct way of reacting to all option DOM elements having set their selected property to false explicitly. Of course I might have missed some very important points in the specifications as this was just a quick check.

Feel free to correct me. I might take some time to investigate which browsers really need this. Because skipping this step would bring performance improvements if you call. So the fix would be "coincidental" and the underlying "issue" with WebKit would remain. So until we decide if the perf improvement to removeAttr is worth it I leave this ticket open. It seems that webkit has fixed the issue for us: Hosting provided by Media Temple CDN provided by MaxCDN.

Download Documentation Tutorials Bug Tracker Discussion. Bug Tracker View Tickets Ticket Graph Roadmap Recent Changes. Tracker Account GitHub Login Preferences. Opened 6 years ago Closed 6 years ago Last modified 3 years ago.

Description last modified by jitter Hi. You can check it yourself with following w3c validated little code: Oldest first Newest first Threaded. Show comments Show property changes.

html option selected attribute value

Thanks for taking the time to contribute to the jQuery project by writing a bug report. Is this really a jQuery issue?

Is WebKit doing the wrong thing? Is this going to be fixed in jQuery Maybe.

html option selected attribute value

Last edited 6 years ago by jitter previous diff. So take your time.

See TracTickets for help on using tickets. Download in other formats: Comma-delimited Text Tab-delimited Text RSS Feed.

Copyright The jQuery Foundation.

inserted by FC2 system