Js, jQuery, and easyui implement the specified value Assignment Method for the drop-down box, jqueryeasyui

Source: Internet
Author: User

Js, jQuery, and easyui implement the specified value Assignment Method for the drop-down box, jqueryeasyui

Js implementation:

1. Set the I option to selected to select the I option. The Code is as follows: (id is the drop-down box id)

(1) document. getElementById ("id"). options [I]. selected = true;

(2) document. getElementById ("messagetoid"). selectedIndex = 1; (select 1st options)

2. The Code is as follows:

Document. getElementById ("messagetoid"). value = ""; (select option with null value)

JQuery implementation:

1. By selecting the I option, similar to js Implementation 1, the Code is as follows:

$ ("# Id"). get (0). selectedIndex =

1; (select 1st options)

2. You can use the following two methods to determine the value of option:

(1) $ ("# id"). val ("123"); (select option with the value "123)

(2) $ ("# messagetoid"). attr ("value", ""); (select option with null value)

EasyUI implementation:

$ ('# Id'). combobox ('setvalue', 'A'); (select option with A value of ,)

In the above js, jQuery, and easyui implementations, the method for assigning values to the drop-down box is all the content shared by Alibaba Cloud. I hope to give you a reference and support for the help house.

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.