简体   繁体   中英

HTML input not readonly without mobile keyboard

I am developing an on-screen keyboard. I want to disable keyboards of mobile devices while the osk is open. One way is to make input read-only, so that focusing on it not opening the keyboard. But using that solution, the user can't change cursor pointer (and also does not see any cursor while writing with osk) and can't select one part of text to delete.

Is there any other solution to stop mobile device keyboard from openning while focusing on input? Something like a specific attribute or styling value or etc.

Thnaks in advance. TG.

// UPDATE

one solution with readonly

EDIT:

Okay, to hide the keyboard for mobile users is not something you can prevent directly, but there is an alternative.

The "OnFocus" Event activates when a specific elements gets focused. this way you can add a bit of code to prevent a mobile keyboard from popping up.

this way we can add the "Blur()" method to it.

so it would look something like this:

 <input type="text" name="noKeyboardForMobile" onfocus="blur();" /> 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM