-
1. Re: How to display defaultLabel for h:inputText
sivaprasad9394 Jul 20, 2012 12:48 AM (in response to pzelenka00)You can implement the concept with Jquery.It will be very easy for u.
Add jqery.js and jquery min.js files and add the below code in the script file.;
First Name : <input type='text' id='txtFirstName' title="Enter FirstName"/>
script:
$(document).ready(function() {
$('input[type="text"]').each(function(){
this.value = $(this).attr('title');
$(this).addClass('text-label');
$(this).focus(function(){
if(this.value == $(this).attr('title')) {
this.value = '';
$(this).removeClass('text-label');
}
});
$(this).blur(function(){
if(this.value == '') {
this.value = $(this).attr('title');
$(this).addClass('text-label');
}
});
});
});
You have different options to implement the concept.
http://www.dailycoding.com/Posts/default_text_fields_using_simple_jquery_trick.aspx
http://viralpatel.net/blogs/default-text-label-textbox-javascript-jquery/