Created
September 4, 2012 02:21
-
-
Save 06b/3615821 to your computer and use it in GitHub Desktop.
Some mobile browsers autocapitalize inputs, This applies the autocapitalize='off' option to all inputs with a specific class, so it won't autocapitalize them.
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
<script> | |
//Description: Some mobile browsers autocapitalize inputs, This applies the autocapitalize='off' option to all inputs with a specific class, so it won't autocapitalize them. | |
//Author: Andrew Nesbitt | |
$(document).ready(function(){ | |
// disable autocapitalize on .url, .email fields | |
unautocapitalize('url'); | |
unautocapitalize('email'); | |
}); | |
function unautocapitalize(cssClass){ | |
var elems = document.getElementsByClassName(cssClass); | |
for (var j = 0; j < elems.length; j++){ | |
elems[j].setAttribute('autocapitalize', 'off'); | |
} | |
} | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment