Unable to catch keyup event

4 posts, 0 answers
  1. Nathan
    Nathan avatar
    2 posts
    Member since:
    Nov 2012

    Posted 19 Feb 2014 Link to this post

    I am trying to handle the keyup function on a kendocombobox however it seems as though I can only use the change event. Is there a way to catch the keyup events as well?

    HTML:
    <input type="search" id="myInputID"/>

    Javascript:​
    $("#myInputID").kendoComboBox({
                placeholder: "Loan Pool",
                dataSource: loanpools,
                filter: "contains"
            });
     
    $("#myInputID").on({
           keyup: function () {
               //not firing
           },
           change: function () {
               //firing
           }
       });
     

        
  2. Georgi Krustev
    Admin
    Georgi Krustev avatar
    3707 posts

    Posted 20 Feb 2014 Link to this post

    Hello Nathan,

    The ComboBox widget hides the initial input element, as it holds the selected value, and renders another input element, which holds the selected text. I believe that you want to wire the keyup event of the visible input element. Check this help topic showing how to get the visible input element.

    Regards,
    Georgi Krustev
    Telerik
    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
  4. Nathan
    Nathan avatar
    2 posts
    Member since:
    Nov 2012

    Posted 20 Feb 2014 in reply to Georgi Krustev Link to this post

    Thank you for your response Georgi, this got me on the right track and I got the keyup functions working however I was only able to do so after setting a timeout at the end of my document ready function....

    function changeSomething() {
        
        var combobox = $("#myInputID").data("kendoComboBox");    
        combobox.input.keyup(function () {
            //keyup event fires here...
        });
    }
      
    $(function () {
        //Create comboboxes etc....
          
        setTimeout('changeSomething()', 1);    
          
    });
    When I remove the timeout I get a message that states input is null or not an object, which leads me to believe it isn't loaded yet... Any way around this?


  5. Georgi Krustev
    Admin
    Georgi Krustev avatar
    3707 posts

    Posted 21 Feb 2014 Link to this post

    Hello Nathan,

    Did you try to put the initialization code in a document write callback?
    $(function () {
        //Create comboboxes etc....
           
        var combobox = $("#myInputID").data("kendoComboBox");   
        combobox.input.keyup(function () {
            //keyup event fires here...
        });
           
    });
    If the problem persists, please sends a simple jsBin demo, which shows current implementation.

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