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

Assign value from dropdownlist on change

I have a dropdownlist which contains value, text and estimatedHours, how can I estimatedHours  to another input field on change?

<ej-drop-down-list id="serviceList"
                        watermark-text="Select a service"
                        template="<div> ${text} </div> <div class='estHrs'>${estimatedHours} </div>">
                        <e-drop-down-list-fields text="text" estimatedHours="estimatedHours"/>

<ej-numeric-text-box id="EstimatedHours" decimal-places="1" ej-for="@Model.Trade.EstimatedHours" increment-step=".5" />

         function serviceList_change(args) {

             var dropdownObj = $("#serviceList").ejDropDownList('instance');



1 Reply

PO Prince Oliver Syncfusion Team May 29, 2017 07:09 AM UTC

Hi Karen,   
Thank you for contacting Syncfusion support.   
To set ‘estimatedHours’ field in dropdownlist datasource to another input field on change event, we need to get the ‘estimatedHours’ field based on the selected text value from the dropdownlist and then set it to numeric textbox. Kindly refer to the following code snippet.   

    function serviceList_change(args) { 
        var dropdownObj = $("#serviceList").ejDropDownList('instance'); 
        var numericObj = $("#EstimatedHours").data("ejNumericTextbox"); 
        var selectedhour; 
        for(i = 0; i < dropdownObj.model.dataSource.length; i++) {  
            if (dropdownObj.model.dataSource[i].text == args.selectedText) {  
                selectedhour = dropdownObj.model.dataSource[i].EstimatedHours 
        numericObj.setModel({ value: selectedhour }); 


Live Chat Icon For mobile
Up arrow icon