Return to Snippet

Revision: 20073
at November 6, 2009 05:38 by jinjiru


Initial Code
// Live Comment Preview jQuery function
$(function() {
$('#comment').one('focus',function() {
});
var $comment = ''; 
$('#comment').keyup(function() {
$comment = $(this).val();
$comment = $comment.replace(/\n/g, "<br />").replace(/\n\n+/g, '<br ><br />').replace(/(<\/?)script/g,"$1noscript");
$('p.live-preview').html($comment);
});
});



<div class="comment-preview">
<h3>My Comment Preview</h3>
<p class="live-preview">placeholder text</p>
</div>

Initial URL


Initial Description


Initial Title
Live comments preview for ExpressionEngine

Initial Tags
jquery

Initial Language
JavaScript