Event when text is manually removed from ComboBox

2 posts, 1 answers
  1. Carrie
    Carrie avatar
    27 posts
    Member since:
    Aug 2013

    Posted 23 Oct 2013 Link to this post

    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
          }
      }
  2. Answer
    Dimiter Madjarov
    Admin
    Dimiter Madjarov avatar
    2153 posts

    Posted 24 Oct 2013 Link to this post

    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!
  3. Kendo UI is VS 2017 Ready
Back to Top