Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disable Mac OS X Lion Safari's autocorrect on contentEditable div?

We have a web application that has a large number of contentEditable <div>'s. With the aggressive autocorrect in Safari on Mac OS X Lion, we have had a number of problems with Safari attempting to autocorrect for our users.

I have been able to stop this from happening by manually going to 'Edit>Spelling and Grammar' and disabling the 'Correct Spelling Automatically' option. I'm wondering, however, if there is a way to do this programmatically, either in javascript or using html attributes. From Apple's documentation (https://developer.apple.com/library/archive/documentation/AppleApplications/Reference/SafariWebContent/DesigningForms/DesigningForms.html), there is an 'autocorrect' attribute on html form fields that let the site designer decide if autocorrect should be on or not.

Is this 'autocorrect' attribute only on mobile safari? Does it work on contentEditable divs? If not, is there an alternative other that just telling the users to go and turn off autocorrect manually?

like image 490
erlloyd Avatar asked Nov 05 '22 10:11

erlloyd


1 Answers

You can use the spellcheck attribute to enable or disable spell checking (possible values are true and false)

You can find more details about this attribute in the HTML5 spec.

like image 115
dcro Avatar answered Nov 16 '22 10:11

dcro