Skip to content
This repository was archived by the owner on Jul 24, 2019. It is now read-only.

placeholder text #143

Open
KaitaniLabs opened this issue Apr 18, 2014 · 4 comments
Open

placeholder text #143

KaitaniLabs opened this issue Apr 18, 2014 · 4 comments

Comments

@KaitaniLabs
Copy link

Just wondering if there is anyway to hook in HTML5's placeholder text system with this plugin. Would be a nice feature.

steveathon referenced this issue in steveathon/bootstrap-wysiwyg Apr 28, 2014
Tested in Safari, FF and Chrome. Not tested on mobile.
steveathon referenced this issue in steveathon/bootstrap-wysiwyg Apr 28, 2014
…and #136

* Created examples
	- Basic (no toolbar)
	- Simple Toolbar
	- Clear formatting button as per request #138
* Moved layout to css/ src/ js/
* Added :focus support as per request #141
* Validated bower.json as per request #134 (Valid JSON)
@steveathon
Copy link

I've added support for this and checked it - seems to work pretty ok. Not suggesting it's the best way to approach it, but it works. Code is in the above commit.

@KaitaniLabs
Copy link
Author

@steveathon looks good. I can't think of a better way to do it other than a bit of JS. Thanks

@steveathon
Copy link

The examples all have the placeholder in there now - seems to work on all the browsers I've tested on so far. Let me know if it fails and I'll fiddle with it.

@blue2blond
Copy link

blue2blond commented May 1, 2017

Placeholder-solution didn't work for me as I had multiple editors on a page and the placeholder was replacing the initial value as well as saving the placeholder after submit. I changed it to the following, user CSS before pseudo-class to show the placeholder and toggling the visibility using JS.

JS:
if ( editor.attr('placeholder') != '' ) { if ( editor.text() == '' ) editor.addClass('show-placeholder'); editor.bind('focus',function(e) { editor.removeClass('show-placeholder'); }).bind('blur',function(e) { if ( editor.text() == '' ) editor.addClass('show-placeholder'); }) }

CSS:
.editor[placeholder]:before { content: attr(placeholder); color: #777; position: absolute; display: none; } .show-placeholder[placeholder]:before { display: block; }

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants