Created
December 27, 2012 18:29
-
-
Save wpscholar/4390673 to your computer and use it in GitHub Desktop.
Prevent the display of the pop-up keyboard on mobile devices
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Using this snippet of code, just add the 'mobile-no-keyboard' class to your input or textarea | |
* to prevent the keyboard display on most mobile devices. You can just add the 'readonly' attribute, | |
* but there may be reasons you don't want to on a desktop/laptop machine. | |
*/ | |
jQuery(document).ready(function($) { | |
if( /Android|webOS|iPhone|iPad|iPod|BlackBerry/i.test(navigator.userAgent) ) { | |
$('input.mobile-no-keyboard, textarea.mobile-no-keyboard').attr( 'readonly', 'readonly' ); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment