)
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. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Essential JS2

Syncfusion jQuery based widgets are no longer in active development. Switch to our pure JavaScript based next generation Essential JS 2 library.

Syncfusion Feedback

How to set focus to the filterSearch textbox dynamically?

Platform: jQuery |
Control: ejDropDownList |
Published Date: November 30, 2017 |
Last Revised Date: May 7, 2019
Tags: javascript

Description:

Set focus to the filter search box of DropDownList dynamically.

Solution:

Set focus to the filter search input box of DropDownList dynamically by executing the focus () method on search box in the _OnPopupHideShow method of DropDownList.

Refer to the following code snippet:

Javascript:

<input type="text" id="skillsets" />
 
<script type="text/javascript">
        var target;
        $(function () {
            var skillset = [
                { skill: "ASP.NET" }, { skill: "ActionScript" }, { skill: "Basic" },
                { skill: "C++" }, { skill: "C#" }, { skill: "dBase" }, { skill: "Delphi" },
                { skill: "ESPOL" }, { skill: "F#" }, { skill: "FoxPro" }, { skill: "Java" },
                { skill: "J#" }, { skill: "Lisp" }, { skill: "Logo" }, { skill: "PHP" }
            ];
            $('#skillsets').ejDropDownList({
                dataSource: skillset,
                fields: { text: "skill" },
                enableFilterSearch:true,
                showCheckbox: true,
            });
            target = $('#skillsets').data("ejDropDownList");
             var srcFunction = target._OnPopupHideShow; 
             target._OnPopupHideShow = function (e) { 
                srcFunction.call(this, e); 
               $(target.inputSearch).focus();             
            }
        });
      
          </script>

 

DropDownlist

 

 

N>  By default, filter search input box will be focused on popup in 15.2.0.40 and the above versions. This workaround is applicable for older versions that is before 15.2.

 

 

 

ADD COMMENT
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon