Results 1 to 1 of 1
Nov 11, 2012, 03:21 #1
- Join Date
- Nov 2010
- 0 Post(s)
- 0 Thread(s)
Fire a function on Select Content in TinyMCE Visual Editor in WordPress
My actual requirement is, When I select some text in WordPress visual editor, and then my custom text is replace in place of that text. I can do this in HTML Editor of Wordpress, but not in Visual Editor, as it is an iframe.
Only one thing worked but not fulfills my requirement, when I wrote a anchor tag after body part, and then the following script alerts the selected text.
var selectedText = jQuery("#content_ifr").prop("contentWindow").getSelection().toString();
var linkText = "<a href='yourlink.html'>"+selectedText+"</a>";