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

Event when text is manually removed from ComboBox

1 Answer 118 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Carrie
Top achievements
Rank 1
Carrie asked on 23 Oct 2013, 11:33 AM
Hello,

I am implementing a ComboBox and I need to do something when the user manually removes the text from the ComboBox.  

Can you help me figure out the appropriate event if there is one?

I have tried using the change event (code below) but it is not fired when the user manually removes text.

Thanks,
Carrie
change: function (e) {
      if (this.select() < 0) {
         //do something here
      }
  }

1 Answer, 1 is accepted

Sort by
0
Accepted
Dimiter Madjarov
Telerik team
answered on 24 Oct 2013, 03:00 PM
Hello Carrie,


A short way to achieve this would be to bind the keyup event of the input of the ComboBox and check if the value is empty.
E.g.
var combo = $("#combobox").data("kendoComboBox");
 
combo.input.on("keyup", function (e) {
    if (this.value == "") {
        alert("text deleted");
    }
});

 

Regards,
Dimiter Madjarov
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
Carrie
Top achievements
Rank 1
Answers by
Dimiter Madjarov
Telerik team
Share this question
or