We will be needing a js file and a page containing form input field to do this task. What we are planning to do is, The input field contains default value. Onclick default value disappears and allows the user to insert text. If the user types anything it remains there but if he does not write anything and clicks at next input field than the default value reappears in previous field.
JS file Code:
function remName(a, b){ if(a.value==b){ a.value=''; }else if(a.value==''){ a.value=b; }else{ a.value=a.value; } } function chkName(a, b){ if(a.value==''){ a.value=b; }else{ a.value=a.value; } }
Two functions are controlling the event as above. Call the js file in the page and define input fields and put some code like this.
Input Fields:
<input name="txtName" type="text" id="txtName" onfocus="remName(this, 'Name');" onblur="chkName(this, 'Name');" value="Name"> <input name="txtEmail" type="text" id="txtEmail" value="Email" onfocus="remName(this, 'Email');" onblur="chkName(this, 'Email');">
and so on...
Related Posts
Searches for Topic
onblur html, onblur form validation, onclick form validation, form validation onblur, input field onblur, form input onclick, text disappear on click, input onblur, onblur input field, onblur validation, contact form 7 onclick, input onblur html, input field onclick, javascript form validation onblur, javascript form validation onclick, html onfocus, onclick remove text input, onclick text disappear, onblur onfocus, onBlur onClick and onFocus, onblur onclick, onblur on focus pdf, onclick text input blank search html, onclick turns into an input box, onblur on chrome, onclick validate input text, onclick remove check, onclick input box, onclick disappear text box value, onclick delete text, onClick as valid code, onblur xhtml, onblur validate 2 javascript function, onblur text value validation javascript, onClick google chrome, onblur search javascript, onblur onfocus javascript, onclick html function validate, onfocus and onblur form value, onblur input, login form click text, label text change in XHTML form, js input onblur, javascript value of input field disappears, javascript validation with onfocus onblur, javascript validation make text appear, javascript validating textbox with default text, javascript textfield value disapears onClick, javascript textbox text disappears on click, javascript textbox text click disappear, javascript text onblur search, javascript onfocus onblur internet Explorer, javascript onfocus in google chrome, login form validations in javascript code onfocus, make changes to input text, make input value disappear onclick, onblur 2 function, onblur for input field value, onblur field text value, onblur any field javascript, onBlur and onFocus website codes, onblur and onfocus on text fields, on focus search field text, on focus javascript validation, on click text dissapears html, on click remove text input field, on click disappear text html, on blur validation focus javascript, mobile safari onblur focus, javascript onfocus html input field, xhtml valid form onfocus, username and password input boxes on click disappear text, Two textbox validation in javascript(html), to disappear value in html on click, textfield onblur with javascript, textbox text onclick and onblur, text in form field onclick disappear, text field value click disappear, text field onclick, text disappears on click, setting focus ice inputtext, search on click textbox on blur, search javascript disappear on click, search box onfocus html, script input forms with text that disappears when clicked, valid field onblur, validate form onclick, validate form onfocus, xhtml onclick blank, xhtml javascript validation data, xhtml input onblur, XHTML codes for form table names, xhtml , xaml textbox default text disappears on text input, wordpress input value disappear, windows forms onfocus, web form text field default text disappear on click, validations of text fields in java, validation text, validation fields in win mobile forms, validating default values in text boxes in javascript, validate onclick script, same page validation form php with onfocus, removing input value onfocus onblur, php input onfocus, php forms onfocus, php form validation onblur, php form onclick value disappear, os validation avg msi, onfocus=remName(this, onfocus validation w3c, onfocus validation in javascript, onfocus onclick javascript, onfocus onblur input for all form fields, onfocus javascript code for validation, onfocus inputbox after validation, onfocus input field, onfocus html, php input text box remove default value on click, php input text dissapear, php javascript input type text onfocus function, remove value onfocus php, Remove Validation from email Field in php, remove text from search form on focus, remove text from input on click js, remove text from input box onclick in as2, remove text from form field on focus, remove html from input field flash, remove existing text from text field onfocus in js, remove default value on focus in html forms, php textbox text disapear, php script in value of html form input box, php onclick add input text, php onblur javascript, php onblur, onfocus as3, javascript onblur validation to check blank textbox, how to make the text onclick disappear using javascript, form input field onclick clear value, form fields onblur, form field text onclick disappear, focuse input text as3, flash text input validate email, flash onfocus text disappear but not after user input, flash onblur input, flash input field validation from, flash actionscript event onfocus, file field change event in chrome, field text with text but after click disappear, felid box search text - onclick dissapears, facebook html form input box, form input remove text focus, form intput text disappear onclick, form javascript onclick text value, how to delete the text in input with onclick, how to create an input field and receive email, how make input fields disappear in a html form, google forms javascript validation, google forms default values, form window with text that disappears, form validation with onblur values and onfocus values, form validation not working on on focus() onBlur, form validation in wordpress, form validation in javascript with onclick e, form onclick validate, form onblur onfocus, form on click blank value, events php when data is entered in a form field, email text inmput validation as3, disappearing default text in form field, blogger onblur in search form, as3 textinput remove focus, as3 textinput onFocus, AS3 textbox onfocus, as3 text disappear on blur, as3 input text focus remove text, as3 input onfocus, as3 input click, as3 delete input text, as2 text input name field, AS2 TEXT IN FORM FIELD, actionscript text in form field when you click it clears, actionscript 3 form input xhtml, Chrom onblur, clear default text onclick, clear input boxes onclick, disappear field value, disapear text onclick input, default value to form input box, default value input box onfocus clear, default value for text input field in html, default text input form java, contact form validation onfocus, contact form make value text disappear on click, Contact Form 7 Input Fields Values, contact form 7 default value disappear, code for making input text disappear, click and remove text input field flash, Clearing Default Text | removing text from form input boxes with, onblur onfocus



Grzesiek Says:
thanks, helpful
Soeren Says:
You don’t even need all that complicated stuff. You don’t even need a javascript file. Here is a much easier way.
That’s all you need, and it does the exact same thing.