Jump to content

hw to create value in form disappear when clicked


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 post
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 post
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 post
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 post
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 post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...