Manually Set Focus

Is there a way to manually set focus on a MVC DropDownLIst in Javascirpt , similar to standard 

$( "#target" ).focus();


1 Reply

KR Keerthana Rajendran Syncfusion Team May 5, 2016 09:57 AM UTC

Hi Matthew,    
Thank you for contacting Syncfusion support,   
 Yes, we can set focus to DropDownList by setting focus() method to the wrapper element of Dropdown.    
 <code>   
<div class="control" style="floatleft;">   
            <span class="txt">Select Group</span>   
           @Html.EJ().DropDownList("groupsList").Datasource((IEnumerable<groups>)ViewBag.datasource)   
        </div>   
</code>   
  
To set Focus on creation:   
 <code>   
<script>   
   
    $("#groupsList").ejDropDownList({   
        create:function(){ $("#groupsList_wrapper").focus();},   
        });   
       
</script>   
</code>   
 Please refer the below link for DropDownList client side API’s:   


 
We have also set focus to DropDownList in our online demos sample using shortcut key.   
 Please refer the below given link:   
 Please let us know if you have any concern.    
Regards,   
Keerthana.   


Loader.
Up arrow icon