سؤال

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?

هل كانت مفيدة؟

المحلول

contenteditable is supported from IOS 5 onward

Go here on your iPad to try it out

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

نصائح أخرى

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,

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top