I need to have the <p></p>
that开发者_JAVA百科 are automatically added by TinyMCE at the very beginning and the end removed.
How?
Thanks.
I found http://tinymce.moxiecode.com/wiki.php/TinyMCE_FAQ#Select_if_default_text.2C_then_delete_when_typing_starts.3F , you may want to take a look at that.
You could use javascript (jquery) and do something like
var contents = $('.tiny-mce-text p').innerHTML;
$('.tiny-mce-text p').remove();
$('.tiny-mce-text').innerHTML(contents);
Or you could use PHP (or any other serverside script) to remove it, with a regular expression.
$text = preg_replace('^<p>', '', $text);
$text = preg_replace('</p>$', '', $text);
http://php.net/manual/en/function.preg-replace.php
This helps write regular expressions: http://gskinner.com/RegExr/
Good luck.
精彩评论