I want to put some help text in an editor instance that disappears on focus. So far I have:
which works but I don't like having to hard code "<p>" and and "</p>\n". Any tips for improvement?
for (instance in CKEDITOR.instances) { var editor = CKEDITOR.instances[instance]; editor.on('focus', function(event) { if (event.editor.getData() == "<p>" + ckeditor_default_text[event.editor.name] + "</p>\n") { event.editor.setData(""); event.editor.focus(); } }); editor.on('blur', function(event) { if (event.editor.getData() == "") { event.editor.setData(ckeditor_default_text[event.editor.name]); } }); }
which works but I don't like having to hard code "<p>" and and "</p>\n". Any tips for improvement?