Skip to content

Instantly share code, notes, and snippets.

@philtr
Created June 11, 2019 14:29
Show Gist options
  • Save philtr/70f907d1dd366c2c3f0ceb0ca8c90b87 to your computer and use it in GitHub Desktop.
Save philtr/70f907d1dd366c2c3f0ceb0ca8c90b87 to your computer and use it in GitHub Desktop.
Disable all the autocorrect and smart quotes for textareas on iOS
<textarea id="stupid" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"></textarea>
<script>
function checkInput(e) {
if ((e.which == 39) || (e.which == 8216) || (e.which == 8217)) {
e.preventDefault();
document.execCommand('insertText', 0, "'");
}
}
var el = document.getElementById('stupid');
el.addEventListener('keypress', checkInput, false);
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment