The problem with the jQuery above is that the first item of the dropdown is not selected when the dialog opens. This is a problem if I want the text of the first item.
How do I modify the code above to get the text of any selected item? Thanks in advance.
MSDN Community Support
Please remember to click "Mark as Answer" the responses that resolved your issue.
If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.
Member
28 Points
113 Posts
Get Text Of Selected Dropdown
Sep 24, 2016 01:13 AM|madjester|LINK
I have a dialog that contains a dropdown, please see below.
I was able to dynamically popuplate the dropdown in the dialog and was able to get the text of some of the selected items using the jQuery code below.
The problem with the jQuery above is that the first item of the dropdown is not selected when the dialog opens. This is a problem if I want the text of the first item.
How do I modify the code above to get the text of any selected item? Thanks in advance.
Contributor
6874 Points
1980 Posts
Re: Get Text Of Selected Dropdown
Sep 24, 2016 01:29 AM|RichardY|LINK
If you are populating the drop down then add the "selected" attribute to the first option.
Contributor
2990 Points
1210 Posts
Re: Get Text Of Selected Dropdown
Sep 24, 2016 09:39 AM|Deepak Panchal|LINK
Hi Madjester,
use something like below.
example
Regards
Deepak
Please remember to click "Mark as Answer" the responses that resolved your issue.
If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.