HTML Mobile -forcing the soft keyboard to hide

前端 未结 8 1952
时光说笑
时光说笑 2020-11-27 03:40

I am developing the front end site for a coupon company, and I have a page where the user only needs to input phone number and $$ spent. We came up with a fun on-screen keyb

相关标签:
8条回答
  • 2020-11-27 04:22

    For further readers/searchers:

    As Rene Pot points out on this topic,

    By adding the attribute readonly (or readonly="readonly") to the input field you should prevent anyone typing anything in it, but still be able to launch a click event on it.

    With this method, you can avoid popping up the "soft" Keyboard and still launch click events / fill the input by any on-screen keyboard.

    This solution also works fine with date-time-pickers which generally already implement controls.

    0 讨论(0)
  • 2020-11-27 04:29

    I could not use some of the suggestions provided.

    In my case I had Google Chrome being used to display an Oracle APEX Application. There were some very specific input fields that allowed you to start typing a value and a list of values would begin to be displayed and reduced as you became more specific in your typing. Once you selected the item from the list of available options, the focus would still be on the input field.

    I found that my solution was easily accomplished with a custom event that throws a custom error like the following:

    throw "throwing a custom error exits input and hides keyboard";
    
    0 讨论(0)
提交回复
热议问题