在niceditor中加入一些文字

时间:2014-03-21 08:51:31

标签: javascript php html nicedit

我有一个简单的脚本,在textarea中放了一些文本:

的Javascript

<script language="javascript" type="text/javascript">
$(document).ready(function(){
  $("#add").click(function(){
      $('#comment').html('[quote] <?php echo link_to($comment->user->username, 'profile/'.$comment->user->username); ?> written: <?php echo $comment->content; ?> [/quote]');
  });
});
</script>

HTML

<textarea id="comment" name="comment"></textarea><br />

但是在我刚刚工作的时候我关掉了niceditor

我的niceditor代码:

 <script type="text/javascript">
    //<![CDATA[
            bkLib.onDomLoaded(function() { nicEditors.allTextAreas({buttonList : ['bold','italic','underline','strikeThrough','image','upload','link','unlink']} ) });

        //]]>
 </script>

1 个答案:

答案 0 :(得分:0)

如果你只使用php和nicedit,你应该将php代码直接放在标签

例如

<textarea id="comment" name="comment"><?php echo link_to($comment->user->username, 'profile/'.$comment->user->username); ?> written: <?php echo $comment->content; ?></textarea>