You can use this jQuery to achieve this
jQuery.fn.labelOver = function(overClass) {
return this.each(function(){
var label = jQuery(this);
var f = label.attr('for');
if (f) {
var input = jQuery('#' + f);
this.hide = function() {
label.css({ textIndent: -10000 })
}
this.show = function() {
if (input.val() == '') label.css({ textIndent: 0 })
}
// handlers
input.focus(this.hide);
input.blur(this.show);
label.addClass(overClass).click(function(){ input.focus() });
if (input.val() != '') this.hide();
}
})
}
Implenentaion:
Add this code into your view/html page
CSS:
DIV { position: relative; float: left; }
LABEL.over-apply { color: #ccc; position: absolute; top: 5px; left: 5px;}
Change top and left to fit your textbox.
Javascript:
$('label').labelOver('over-apply')
Thanks for this Post