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

Set Value from JS

     I just need to set the value of the dropdownlist via JS. I feel like this should be simple but nothing seems to work. A snippet would be great. 


1 Reply

KR Keerthana Rajendran Syncfusion Team June 19, 2017 07:18 AM UTC

Hi Ryan, 
Thank you for contacting Syncfusion support 
We can use value property directly in MVC to select an item initially. Please refer to the below code snippet 
@Html.EJ().DropDownList("selectCar").TargetID("carsList").ShowCheckbox().EnableRTL(false).Width("150px").Value("Audi A6") 
            <div id="carsList"> 
                    <li>Audi A4</li> 
                    <li>Audi A5</li> 
                    <li>Audi A6</li> 
                    <li>Audi A7</li> 
                    <li>Honda H1</li> 
                    <li>Honda H2</li> 
                    <li>Honda H3</li> 
                    <li>Honda H4</li> 
We can also bind value through JS during DropDownList creation as shown below 
        function oncreate() 
            var ddlobj = $("#selectCar").data("ejDropDownList") 
            ddlobj.option({ value: "Audi A7" }); 
We have prepared sample for your reference. Please refer to the below given link 

Live Chat Icon For mobile
Up arrow icon