Archived topic
How to hide smartphone keyboard in specific fields
3 replies · Started by Luiz Guilherme on July 31, 2021
For example, in date fields, where wordpress displays fields to choose the date, the keyboard could be auto hidden.
Hi there,
This isn't something the theme can control.
I'm not sure if this is something WordPress can control either.
Might just be a browser aspect of things.
I solve with this function:
Obs.:
196 is the number of the page!
g196-chegada and g196-sada are the ID of que data fields
You need to change this 3 information on your code.
/* JETPACK - DATE field of forms: Disabling Mobile Keyboard */
function js_on_specific_pages_f() {
if (is_page ('196')) { echo'
<script>
document.getElementById("g196-chegada").readOnly=true;
document.getElementById("g196-sada").readOnly=true;
</script>
'; }
}
add_action('wp_footer', 'js_on_specific_pages_f');
Glad to hear :)