TinyMCE tooltip text

I am using the Remy Sharp jQuery plugin to display tooltips in text fields.

I would like to do the same with TinyMCE - display a tooltip, for example "Type some text here.", and when the user focuses on the TinyMCE editor, this text should disappear. If the editor is empty (no text entered), then the text should be visible again when blurring.

Is there a jQuery plugin capable of doing this? Or is there an API in TinyMCE that I could use for this function?

+3
source share
1 answer

TinyMCE must go through any content already in the text field, so

<textarea name="content" id="content">Type some text here</textarea>

, jQuery - :

TinyMCE.focus(function(){
 if ($(this).getContent() == "Type some text here"){
  tinyMCE.setContent("");
 } else if ($(this).getContent() == ""){
  tinyMCE.setContent("Type some text here");
 }
})

, getContent setContent - , tinyMCE api... , .focus() . TinyMCE textarea iframe, ...

+4

Source: https://habr.com/ru/post/1757056/


All Articles