set value won't work

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • cleary1981
    New Member
    • Jun 2008
    • 178

    set value won't work

    Hi,

    Can't see where I have went wrong with this line of code. What I want to do is everytime this box gets focus I want a default value of 1 to be shown.

    [HTML]<input type = "text" value = "1" name = "quantity" id = "quantity" onfocus="docume nt.getElementBy Id('quantity'). value = 1"></td>[/HTML]

    It is fine the first time as the value is already declared but on each attempt after it doesn't show
  • acoder
    Recognized Expert MVP
    • Nov 2006
    • 16032

    #2
    It should work, though you could use this.value and use a string instead of an integer. Check the ID is unique. Are there any errors?

    Comment

    • cleary1981
      New Member
      • Jun 2008
      • 178

      #3
      thanks, using this.value did the trick

      Comment

      • acoder
        Recognized Expert MVP
        • Nov 2006
        • 16032

        #4
        Good. Glad it's working :)

        Comment

        Working...