Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1922
Get the current Value of a WebDropDown in JavaScript
posted

Hi,

I'm trying to get the the currently selected value of a WebDropDown when the user changes the DropDown.

In order to do that I hooked up the WebDropDowns ClientEvents ValueChangedEvent which has the parameters sender and e.

e has a method called getNewValue() which returns the text of the selected item, not the value itself.

So what I came up with is:

function

 

MyDropDown_ValueChanged(sender, e) {

  var value = sender.get_selectedItem().get_value();

}

This seems to work but looks a little bit ugly. So I wondered if theres a more elegant way of doing it? Maybe I missed a method or a property ...

Thanks in Advance

Andre

Parents
No Data
Reply
  • 24671
    Verified Answer
    posted

    Hey Andre,

    Thanks for your feedback. Currently the way to get it is the one you have already provided in the code above :) We will consider adding a more straightforward way in the API.

    Thanks again,

    Angel 

Children
No Data