Вы можете вручную добавить/удалить заполнитель, используя события nicEditor.
focus
Отправить, когда редактор получает фокус (IE кто-то нажимает на него).
blur
Отправлено, когда экземпляр редактора теряет фокус.
var editor = new nicEditor();
var $placeholder = '<p>Click here to add content...</p>';
$('[id^="textArea"]').each(function() {
var textAreaId = $(this).attr("id");
editor.addInstance(textAreaId);
var editorInstance = editor.instanceById(textAreaId)
// Add the initial Placeholder
var content = editorInstance.getContent();
if(content == "" || content == "<br>"){
editor.instanceById(textAreaId).setContent($placeholder);
}
// onFocus - Remove the placeholder
editor.addEvent('focus', function()
{
if (editorInstance.getContent() == $placeholder){
editor.instanceById(textAreaId).setContent("<br>");
}
});
// onBlur - Re-add the placeholder
editor.addEvent('blur', function()
{
var newText = editorInstance.getContent();
if(newText == "" || newText == "<br>") {
editor.instanceById(textAreaId).setContent($placeholder);
}
});
});
Сначала проверьте, чтобы увидеть, если нет контента, или если есть один <br>
(это заполнитель nicEditor в). Если это так, замените местозаполнитель.
Затем на проверку фокуса на местозаполнитель и изменение содержимого обратно на "<br>"
.
Затем при размытии проверьте, не осталось ли содержимое и замените его на заполнитель снова