This is a migrated thread and some comments may be shown as answers.

[Solved] Setting Dropdownlist to a value from jquery

1 Answer 34 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Amit
Top achievements
Rank 1
Amit asked on 18 Oct 2012, 06:11 AM
Hi All,

My drop down has the following values :
US USA
IN India
and other countries.

In my jquery i want to set the selected item in dropdown to "IN India" by just passing the "India". I would like to know if there is a way to achieve that.

Regards,
Amit

1 Answer, 1 is accepted

Sort by
0
Tshencho
Top achievements
Rank 1
answered on 25 Oct 2012, 10:10 AM

//read the drop down
var dropDownList = $('#Dropdown').data('tDropDownList');

//set the value having item text with india
dropDownList.fill(function () {
        dropDownList.select(function (dataItem) {
            return dataItem.Text == "India";
        });
    });

Hope this helped

regards
Tags
General Discussions
Asked by
Amit
Top achievements
Rank 1
Answers by
Tshencho
Top achievements
Rank 1
Share this question
or