0

I have this code running fine in browser, but when I tried to run on the mobile browser, it didn't work. Any good suggestion?

 var oTextArea = this.getView().byId("selectConditionAS"); oTextArea.attachBrowserEvent("keyup", debounce(function() { var searchkey = oTextArea.getValue(); console.log(searchkey); } 
3
  • take a look to jquery-keyup-event-for-mobile-device Commented Oct 7, 2018 at 13:48
  • I have seen this too, any good sample code in ui5? oTextarea.on(“keyup”) is not working... Commented Oct 7, 2018 at 13:55
  • have you tried oTextarea.on(“keyup input”)? Commented Oct 7, 2018 at 14:00

1 Answer 1

0

You don't need to use Browser events if you have SAPUI5 events which does the same. if you are using sap.m.TextArea or sap.ui.commons.TextField then you can use their liveChange event.

var oTextArea = this.getView().byId("selectConditionAS"); oTextArea.attachLiveChange(function(oEvent){ var searchkey = oEvent.getSource().getValue(); console.log(searchkey) }); 

hope this helps.

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks. The problem is I want to detect when the user stop typing and execute the function after X milliseconds. Can I do that with the above code?
attachLiveChange triggers every keystroke, so you would use it exactly the way you would with the default browser method.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.