Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gracefully Degrading ContentEditable on iPhone & iPad

To my dismay, I found out that the contentEditable=true attribute does not work as expected on iPhones or iPads.

Is there a way to gracefully degrade a contentEditable div without resorting to a textarea and losing all of the rich DHTML formatting benefits on an iPhone or iPad?

like image 230
Petrus Theron Avatar asked Oct 11 '22 10:10

Petrus Theron


2 Answers

contenteditable is supported from IOS 5 onward

Go here on your iPad to try it out

http://www.quirksmode.org/dom/execCommand/

like image 130
tim Avatar answered Oct 30 '22 10:10

tim


I hope you have gone through this(Apple's Technical Notes) and Safari Web Content Guide they put following paragraph under Don’t Use Unsupported iOS Technologies

contenteditable is not supported in Safari on iPhone OS. If you're using contenteditable to enable text input within a styled element (for instance, <p contenteditable> or <div contentediable>), you can replace this styled element with a styled <textarea>. In Safari on iPad, iPhone, Mac OS X, and Windows, you can customize the appearance of <textarea> elements using CSS. If necessary, you can even disable any platform-specific, built-in styling on a <textarea> by specifying -webkit-appearance: none.

Thanks,

like image 45
Ravin Avatar answered Oct 30 '22 11:10

Ravin