Return to Snippet

Revision: 13334
at April 20, 2009 09:22 by davebowker


Updated Code
//$('.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");
	})

Revision: 13333
at April 20, 2009 08:09 by davebowker


Initial Code
$('input.ukn-form-textbox').one('focus', function() {
		$('.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();" />');
	});
	$('input.ukn-form-textbox').focus(function() {
		$('.ukn-form-textbox-preview').html($(this).val());
		$(this).keyup(function() {
			$('.ukn-form-textbox-preview').html($(this).val());
		})
	});
	$comment = $comment.replace(/\n/g, "<br />").replace(/\n\n+/g, '<br /><br />').replace(/(\<\/?)script/g,"$1noscript");

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

Initial Description

                                

Initial Title
jQuery ajax comment preview

Initial Tags
ajax, jquery

Initial Language
JavaScript