Disable the keyboard "return" button in ionic 2


#1

Hi together,

How to disable the keyboard “return” button in ionic 2?

Thanks


#2

This is a harder question than it probably seems. Does it have to work both on browser and device? Everywhere or only when specific components are focused?


#3

My ionic app will be deployed only on device. I would appreciate it, if I could have an option to disable the “return” button only when specific components are focused.

Regards


#4

Do you want to “disable” (nothing happens when used) or “remove” (is not displayed) it?


#5

Disable (nothing happens when used)


#6

Often I’ve found that when I thought I wanted to do this, I was actually failing to add type="button" to my non-submit buttons that happened to be inside forms.

If that’s not the case, I would look into binding (keyup.enter)="swallow()" and having swallow() return false.


#7

Thanks! I will try it.