jQuery ajax comment preview


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



Copy this code and paste it in your HTML
  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. })

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

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.