Return to Snippet

Revision: 31741
at September 11, 2010 07:18 by Meander365


Initial Code
function watermark ($obj) {
				
	var prev;
	
	$obj.each(function() {
		if ($(this).attr("title"))	$(this).val($(this).attr("title")).addClass("greyout");
	});
	
	$obj
		.focus(function()
			{
				if ($(this).val()==$(this).attr("title")) {
					prev = $(this).val();
					$(this).val("").removeClass("greyout");
				}
			})
		
		.blur(function()
			{
				if($(this).val()=="") {
					$(this).val(prev).addClass("greyout");;
				}
			});

}

Initial URL


Initial Description


Initial Title
Using Input Title As Initial Text - Hide When On Focus

Initial Tags
javascript, jquery

Initial Language
jQuery