Posted By

davebowker on 04/20/09


Tagged

ajax jquery comment preview


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

umang_nine


jQuery ajax comment preview


 / Published in: JavaScript
 

URL: http://www.learningjquery.com/2006/11/really-simple-live-comment-preview

  1. //$('.ukn-search-advanced').append('<em>Looking for:</em><div class="ukn-form-textbox-preview"></div><input class="ukn-search-advanced-submit" type="button" value="Search" onclick="this.form.submit();" />');
  2. $('.ukn-form-textbox-preview').html($(this).val());
  3. $(this).keyup(function(){
  4. if ($('.ukn-form-searchbox').val() !== "") {
  5. $('.ukn-search-advanced-extra').show();
  6. }
  7. var $comment = '';
  8. $comment = $(this).val();
  9. $('.ukn-form-textbox-preview').html($comment);
  10. $comment = $comment.replace(/\n/g, "<br />").replace(/\n\n+/g, '<br /><br />').replace(/(\<\/?)script/g, "$1noscript");
  11. })

Report this snippet  

You need to login to post a comment.