By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,567 Members | 1,592 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,567 IT Pros & Developers. It's quick & easy.

Changing an initial value using javascript

P: 1
Hi All,

I'm wondering how I would change an initial value to a blank value if nothing gets entered into the text field. I have a form with multiple fields that visitors can enter data in to get the search results they want. For example right now I have this,

Expand|Select|Wrap|Line Numbers
  1. <input  id="IDX-text_landArea" name="kw_landArea" maxlength="255" type="text" onfocus="if (value == 'Lot Size') {value =''}" onsubmit="if (value == 'Lot Size') {value = ''}" value="Lot Size"/>
  2.  
If that stays as is when someone hits the submit button without changing that specific text field than I don't get the results I want because it passes the "Lot Size" value to the search form.

What I want to know is how I could create a function or something like that that would change the value from "Lot Size" to a blank value. Any and all help is appreciated. Thanks!!!
Aug 27 '09 #1
Share this Question
Share on Google+
1 Reply


gits
Expert Mod 5K+
P: 5,390
the onsubmit is useless at this point since it just works at the form-node. and you use value without declaring or retrieving it from the node ... so basicly it should work when you use this.value instead ... which refers to the node's value property ...
Aug 28 '09 #2

Post your reply

Sign in to post your reply or Sign up for a free account.