Input box initial focus

2 posts, 1 answers
  1. Jason Feng
    Jason Feng avatar
    3 posts
    Member since:
    Apr 2010

    Posted 07 Dec 2012 Link to this post

    I try to set focus to an input textbox in Kendo Window when the Window is opened, it set the focus then the focus is lost immediately. It was working before until recently. See code below:

       <div id="w">        
            <input id="t" />
        </div>

     var win = $('#w').kendoWindow({
                title: 'Test',
                visible: false
            }).data('kendoWindow');
    win.center().open();
    $('#t').select();
  2. Answer
    Iliana Nikolova
    Admin
    Iliana Nikolova avatar
    2595 posts

    Posted 11 Dec 2012 Link to this post

    Hi Jason,

    In order to achieve the desired behavior you could hook up to the activate event of the Kendo UI Window and then select the input. Like here:

    <div id="w">       
          <input id="t"/>
    </div>
     
    <script>
    var win = $('#w').kendoWindow({
        title: 'Test',
        visible: false,
        activate: function(){
          $('#t').select();
        }
    }).data('kendoWindow');
     
    win.center().open();
    </script>
     
    On a side note, there were some focus-related issues in the Kendo UI Window in v.2012.3.1114 which are now fixed. Therefore I recommend using the latest internal build which is available for downloading from your account.

    Regards,
    Iliana Nikolova
    the Telerik team
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  3. Kendo UI is VS 2017 Ready
Back to Top