0

Im trying to obtain a value from a selectbox but I cant ,

Inspector shows me:

https://i.imgur.com/qUhm5ub.png

I tried 2 ways (code below), but I dont know how to get final value

In this case; "Activo"

        //way1
        var way1 = document.getElementById("Patrimonio");
        console.log(way1);
        //way2
        var way2 = document.getElementsByClassName("dx-placeholder");
        console.log(way2);

I expect obtain that value, to store in a javascript variable.

  • Possible duplicate of [Get selected value in dropdown list using JavaScript](https://stackoverflow.com/questions/1085801/get-selected-value-in-dropdown-list-using-javascript) – Alphastrick Aug 12 '19 at 08:53

1 Answers1

1
$("#Patrimonio").dxSelectBox('instance').option('value')
Idriss Benbassou
  • 1,331
  • 2
  • 12
  • 21
  • First: Uncaught TypeError: Cannot read property 'undefined' of undefined Sencond: VM171:324 Uncaught TypeError: Cannot read property '0' of undefined –  Aug 12 '19 at 08:55
  • with jquery try this, $("#Patrimonio").dxSelectBox('instance').option('value') – Idriss Benbassou Aug 12 '19 at 08:59
  • var way2 = $("#Patrimonio").dxSelectBox('instance').option('value'); works!! thanks! –  Aug 12 '19 at 09:10