sbr
sbr

Reputation: 4843

tinyMce setcontent problem in IE

The problem is with TinyMce library on wordpress , when run with Internet Explorer( 7 or 8).

When I add content (like "<h1> hey </h1>"), it adds the content in Firefox/Chrome at the right place, but in IE, it adds to the start of the page (above everything).

Here is the code I use

var txt = "<h1> hey </h1>";

var ed = tinyMCE.getInstanceById(domElementId); // domElementId is the div ID for the textarea where i am adding the content.
ed.selection.setContent(txt);

Can anyone suggest what could be the reason/fix ? Thanks.

Upvotes: 1

Views: 2701

Answers (2)

sbr
sbr

Reputation: 4843

use ed.setContent() instead of using ed.selection.setContent(). It will work fine in IE

Upvotes: 1

Florin
Florin

Reputation: 21

Had the same problem using TinyMCE on Internet Explorer 8, here is the solution I have found:

var ed = tinyMCE.getInstanceById(domElementId);
*ed.focus();*
ed.selection.setContent(txt);

The missing part was the one where focusing.

Upvotes: 2

Related Questions