I am using TinyMCE (http://tinymce.moxiecode.com/) in a .NET page.
Whenever I load a text 
myTMCE.value=mycontent;
I can see that  my text gets wrapped in <p></p>. This is not desirable for me, so I am trying to avoid it.
Trying to initialize in 
        <script>
            tinyMCE.init({
                force_p_newlines: true
            })
        </script>
did not work. Any idea? Thanks in advance, m.
You need to to do this :
<script>
    tinyMCE.init({
        forced_root_block: false,
        //some other options here
    })
</script>
By default TinyMCE sets as a root block. By setting this property to false you remove any wrapper for the text. The below text is from TinyMCE documentation:
This option enables you to make sure that any non block elements or text nodes are wrapped in block elements. For example something will result in output like:
something
This option is enabled by default as of 3.0a1.
If you set this option to false it will never produce P tags on enter or automatically it will instead produce BR elements and Shift+Enter will produce a P.
Note that not using P elements as root block can severely cripple the functionality of the editor.
http://www.tinymce.com/wiki.php/Configuration:forced_root_block
See this thread and the answer in TinyMCE forum. force_p_newline is a gecko only option (ie FF).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With