/ Published in: JavaScript
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
//$('.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();" />'); $('.ukn-form-textbox-preview').html($(this).val()); $(this).keyup(function(){ if ($('.ukn-form-searchbox').val() !== "") { $('.ukn-search-advanced-extra').show(); } var $comment = ''; $comment = $(this).val(); $('.ukn-form-textbox-preview').html($comment); $comment = $comment.replace(/\n/g, "<br />").replace(/\n\n+/g, '<br /><br />').replace(/(\<\/?)script/g, "$1noscript"); })
URL: http://www.learningjquery.com/2006/11/really-simple-live-comment-preview