sebacruz
5/11/2012 - 6:26 PM

gistfile1.js

if ($.browser.msie) {
	$('[placeholder]').focus(function() {
		var input = $(this);
		
		input.css("color", "#333");
		
	  	if (input.val() == input.attr('placeholder')) {
	    	input.val('');
	    	input.removeClass('placeholder');
	  	}
	}).blur(function() {
	  	var input = $(this);
	  	
	  	if (input.val() == '' || input.val() == input.attr('placeholder')) {
	    	input.addClass('placeholder');
	    	input.val(input.attr('placeholder'));
			input.css("color", "#ccc");
	  	}
	}).blur();
	
	$('form').submit(function(ev){
		var form = $(this);
		
		form.find('[placeholder]').each(function(i, e){
			var el = $(e);
			
			if (el.val(), el.attr('placeholder')) {
				el.val('');
			}
		});
	});
}