jamesallardice/Placeholders.js

Placeholders within ContentEditable DIV's (Possible with HTML5 Browsers, see link)

Closed this issue · 1 comments

Hi

Do you is it possible to add this to a div which is set to contenteditable?

I know it is possiable within HTML5 Browsers: http://stackoverflow.com/a/14531126

I need this functionality to work in IE8 though. Any ideas if this is possible?

Thanks
Kev

The placeholder attribute is only valid on elements of type input (with certain type attribute values) and textarea. It is not valid on arbitrary elements with the contenteditable attribute set.

As this is intended to be a true polyfill, in that it enables functionality that was not present in older browsers in the most accurate way possible (you just add the placeholder attribute like usual), support for contenteditable is not really something that should be covered.

The StackOverflow question you've linked to is simply a custom method of showing/hiding the placeholder text at appropriate times. You can quite easily write basic placeholder-style functionality for any contenteditable element, and it would be simpler than this full polyfill since you wouldn't have to bother about things like masked inputs and form submissions.