0
votes

I need to detect a backspace in Appcelerator Android. I have an event listener for a searchBox here:

$.searchInputBox.addEventListener('change', function() {
  var searchInput = $.searchInputBox.value; // Get searchInput value.
  if(searchInput.length >= 2){
    // Do some stuff
  }
}

Is there a way for the search box to detect if a user has deleted some text?

Thanks.

1

1 Answers

2
votes

Try this code

$.searchInputBox.addEventListener('keypressed', function(e) {
 if(e.keyCode === [backspace code]) {
                          //I's a backspace
                      }
}

Dont forgot setfocusable ` property to true for search input