Live Comment Preview for Expression Engine


/ Published in: jQuery
Save to your folder(s)



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

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.