CKEditor value set when html tags used

Using JQuery to set CKEditor Value

My question is in regards to setting the value of a CKEditor. I am able to set the value when its simple text, but when the text has html tags in the value is unable to set.

Any clues?

Maybe there is a question similar already in existence.

Javascript:

 CKEDITOR.instances.contentTexto.setData( '<?php echo $var_myRow['contents']; ?>' );

Ok so I have figured out how to remove the html tags simply by this:

$var_contentString = $var_myRow['contents'];
$var_contents = strip_tags($var_contentString);
echo $var_contents;

And it works! Now when I send my variable to setData(''); like this it still shows nothing. Whats happeing here, can someone explain this a little?

Also when I check the pageSource the data seems to be coming through with the tags in the setData(); function. So its purely a display issue CKEditor has with html tags.

Answers


try this :

CKEDITOR.instances.contentTexto.setData('<?php 
    echo str_replace(array("'"),array("\\\'"),$var_myRow['contents']);
?>');

Need Your Help

Is there something like "listenTo" in jQuery? Or do I have to use namespaces and manually unbind?

javascript jquery backbone.js

I'm using a third-party lazyload plugin: http://www.appelsiini.net/projects/lazyload

Free up memory used by bash script

linux bash memory process

I have a bash script that loops through the results of find for a directory containing hundreds of subdirectories and thousands of files and runs a number of commands on each file, mostly sed and g...