Reputation: 1125
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.
Upvotes: 0
Views: 162
Reputation: 740
Try this code
$.searchInputBox.addEventListener('keypressed', function(e) {
if(e.keyCode === [backspace code]) {
//I's a backspace
}
}
Dont forgot set
focusable ` property to true for search input
Upvotes: 2