This is a migrated thread and some comments may be shown as answers.

Unable to catch keyup event

3 Answers 699 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Nathan
Top achievements
Rank 1
Nathan asked on 19 Feb 2014, 08:46 PM
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
       }
   });
 

    

3 Answers, 1 is accepted

Sort by
0
Georgi Krustev
Telerik team
answered on 20 Feb 2014, 03:20 PM
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!
0
Nathan
Top achievements
Rank 1
answered on 20 Feb 2014, 03:53 PM
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?


0
Georgi Krustev
Telerik team
answered on 21 Feb 2014, 08:31 AM
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!
Tags
ComboBox
Asked by
Nathan
Top achievements
Rank 1
Answers by
Georgi Krustev
Telerik team
Nathan
Top achievements
Rank 1
Share this question
or