JQuery BUG: $. attr (& amp; quot; selected & amp; quot;, tru

Source: Internet
Author: User

Jquery version: 1.10.2

Google chrome can be executed normally.

IE11 and FIREFOX 26 have bugs.


Test 1Test 2Test 3Test 4


To submit multiple options to the server, select all options first. However, when $ ("# id123 option"). attr ("selected", true) of JQUERY is executed, a BUG is easily found and is recorded here.


BUG reproduction: Click the option manually (the option may be sorted), and then click $ ("# id123 option") of JQUERY "). attr ("selected", true), all option source code will be set selected = "selected", but the selection is not highlighted, then submit the server, only values in the highlighted status are received.


Solution: Return to JAVASCRIPT


Var sel = document. getElementById ("id123 ");
For (var I = 0; I <sel. options. length; I ++ ){
Sel. options [I]. selected = true;
}





Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.