SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Member
    Join Date
    Apr 2007
    Posts
    8
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Arrow Delete OnClick with an input field.

    What is the code to basically delete text within an input field when a mouse cursor is clicked within the field such as a input type text. Thanks a bunch!

  2. #2
    SitePoint Wizard Pepejeria's Avatar
    Join Date
    Jan 2005
    Location
    Too far up north
    Posts
    1,566
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Show us what you have so far and lets take it from there.

  3. #3
    SitePoint Member
    Join Date
    Apr 2007
    Posts
    8
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I have no clue where to start, I assume it would be an OnClick function, but I don't know. Newb here

  4. #4
    SitePoint Wizard Pepejeria's Avatar
    Join Date
    Jan 2005
    Location
    Too far up north
    Posts
    1,566
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This is a perfect opportunity for you to learn JavaScript. Spend some time learning it! Fun huh?


  5. #5
    SitePoint Addict
    Join Date
    Aug 2006
    Posts
    266
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Code:
    <form>  
    <input type="text" name="txt1" value ="my text value" onfocus="if(this.value==defaultValue){ this.value ='';} ";> 
    <input type="text" name="txt1" value ="my text value" onfocus="this.value='' ";> 
    </form>

  6. #6
    SitePoint Wizard siteguru's Avatar
    Join Date
    Oct 2002
    Location
    Scotland
    Posts
    3,629
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Or use onclick instead of onfocus.
    Ian Anderson
    www.siteguru.co.uk


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •