hubertj Posted March 31, 2012 Share Posted March 31, 2012 does PHP have a code to clear default values onlick?? For example if I have a text field...How do i insert blurry default value and when user click it the value will be gone if the user did not enter any value then the blurry default value would appear again?? Like on a sign up page...you want to let them know what is the format to by input into the fields. <label for="telno">Contact No.: </label> <input type="text" name="telno" id="telno" class="regfields"/> Quote Link to comment https://forums.phpfreaks.com/topic/260071-clear-default-value-using-php/ Share on other sites More sharing options...
kicken Posted March 31, 2012 Share Posted March 31, 2012 html5 allows you to set a placeholder attribute, ie <input type="text" name="date" value="" placeholder="mm/dd/YYYY"> Otherwise you have to use a little JS to do it, such as <input type="text" name="date" value="mm/dd/YYYY" onfocus="if (this.value==this.defaultValue) this.value='';" onblur="if (this.value=='') this.value=this.defaultValue;"> Quote Link to comment https://forums.phpfreaks.com/topic/260071-clear-default-value-using-php/#findComment-1333012 Share on other sites More sharing options...
hubertj Posted March 31, 2012 Author Share Posted March 31, 2012 Hi...just want to check if all browser support HTML 5?? If i want to use HTML 5 to make form mandatory do i just add the word required will do?? Quote Link to comment https://forums.phpfreaks.com/topic/260071-clear-default-value-using-php/#findComment-1333036 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.