Posted By

jinjiru on 11/06/09


Tagged

jquery ee


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

nirva


Live comments preview for ExpressionEngine


 / Published in: JavaScript
 

  1. // Live Comment Preview jQuery function
  2. $(function() {
  3. $('#comment').one('focus',function() {
  4. });
  5. var $comment = '';
  6. $('#comment').keyup(function() {
  7. $comment = $(this).val();
  8. $comment = $comment.replace(/\n/g, "<br />").replace(/\n\n+/g, '<br ><br />').replace(/(<\/?)script/g,"$1noscript");
  9. $('p.live-preview').html($comment);
  10. });
  11. });
  12.  
  13.  
  14.  
  15. <div class="comment-preview">
  16. <h3>My Comment Preview</h3>
  17. <p class="live-preview">placeholder text</p>
  18. </div>

Report this snippet  

You need to login to post a comment.