How to have a default value in the inputField in Visual Force in a blur format, For e.g. to enter a Number field : the value should be 'Enter a Number'.

As soon as the user clicks to enter the value in the inputField, it should not display anything.

Any advice.

  • :My initial thought is for this type of senario we wmay use Jquery plugin that can be more easier .Let me do some homework on this now. Commented Oct 19, 2012 at 6:27

1 Answer 1


I figured it out in both the ways : for html and apex vf tags. Please find below the code.

Jquery Plugin was the solution.

 <apex:includeScript value="http://digitalbush.com/files/jquery/watermarkinput/beta1/jquery.watermarkinput.js"/>

I used the above JQuery Plugin.

var j$ = jQuery.noConflict(); j$(document).ready(function(j$){ j$('[id$=temp]').Watermark("Enter your Name"); });

 <apex:inputText value="{!strTemp}" id="temp"/>

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .