Changing an initial value using javascript

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jsaps33
    New Member
    • Aug 2009
    • 1

    Changing an initial value using javascript

    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,

    Code:
    <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"/>
    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!!!
    Last edited by gits; Aug 28 '09, 01:56 PM. Reason: added code tags
  • gits
    Recognized Expert Moderator Expert
    • May 2007
    • 5390

    #2
    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 ...

    Comment

    Working...