Jump to content

hw to create value in form disappear when clicked


fikiwan

Recommended Posts

hai friends , can do help me ,how to create value in form disappear when clicked,when form clicked then value in form disappear ...like form search in here , I clicked form and word search disappear ..how to make like tht, ..thks before

Link to comment
Share on other sites

<input type="text" name="search"  value="Search..." onfocus="this.value=''">

once the input has focus, the input value is cleared completely and will never show again, if you make a mistake and to wish to correct the spelling you end up with same problem. One option is to identify when it is default value, hide, But! if not, keep the value entered, also if value deleted manually and you leave the input, return to default value.

<input type="text" name="search" value="Search..." onfocus="if(this.value==this.defaultValue){this.value=''}" onblur="if(this.value==''){this.value=this.defaultValue}">

  • Like 1
Link to comment
Share on other sites

<input type="text" name="search"  value="Search..." onfocus="this.value=''">

once the input has focus, the input value is cleared completely and will never show again, if you make a mistake and to wish to correct the spelling you end up with same problem. One option is to identify when it is default value, hide, But! if not, keep the value entered, also if value deleted manually and you leave the input, return to default value.

<input type="text" name="search" value="Search..." onfocus="if(this.value==this.defaultValue){this.value=''}" onblur="if(this.value==''){this.value=this.defaultValue}">

thanks so much bro its work, :) and how make style value in the form , I want change color, type word,large word ect Edited by fikiwan
Link to comment
Share on other sites

input[type=text] { font-size:20px; color: red;}
ya I knew like that, I can do in style css, But I want style value in the form not same if I fill the data, .. you can try in form search here,if you write a word in the form ,style value which disappear different with style word you write,. hw to make like that you could help me !!, thks before .. note : sorry my english not good :)
Link to comment
Share on other sites

??? you mean like this

input[type="text"] { color: #5A5A5A; font-family:"Century Gothic";}

<input type="text" name="search" value="Search..." onfocus="if(this.value==this.defaultValue){this.value='';} this.style.color='#000000'; this.style.fontSize='16px';" onblur="if(this.value==''){this.value=this.defaultValue;this.style.color='#5a5a5a';this.style.fontSize='14px';}else{this.style.color='#000000'; this.style.fontSize='14px';}">

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...