We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Getting dropdownlist object in javascript to call its methods

Hi,

I'm not able to get the dropdownlist object and call its methods.

 var dropdownList = document.getElementById("DMDropDownList");
dropdownList.selectItemByValue('@Model.DMId.ToString()');

Please let me know where I'm going wrong.

Thank you.

1 Reply

AB Ashokkumar Balasubramanian Syncfusion Team September 9, 2019 10:10 AM UTC

Hi John Stephen Mangam, 
 
Greetings from Syncfusion support. 
 
Could you please refer the below code block for create the instance in EJ2 components? 
  
var dropdownList = document.getElementById("DMDropDownList").ej2_instances[0]; 
 
 
Also, we don’t have the selectItemByValue method in our EJ2 Dropdown List component. But you can achieve this requirement by using value property of Dropdown List, please refer the below API documentation. 
 
 
Please let us know, if you have any concern on this. 
 
Regards, 
Ashokkumar B. 


Loader.
Live Chat Icon For mobile
Up arrow icon