SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Wizard dethfire's Avatar
    Join Date
    Aug 2000
    Posts
    2,477
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    input select all function?

    Is there a javascript fuction around here that when I click inside an input box, the whole contents get selected?
    Free Science Homework Help
    http://www.physicsforums.com

  2. #2
    SitePoint Evangelist
    Join Date
    Jul 2001
    Location
    UK
    Posts
    407
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Maybe:

    Code:
    <input type="text" onClick="javascript:this.select()">
    But it might not work in netscape etc.

  3. #3
    SitePoint Addict
    Join Date
    May 2000
    Posts
    313
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This is what I use and it works in IE and NS;
    <INPUT TYPE="text" SIZE="10" VALUE="some text" onFocus="this.select()">

    You can also use it for a textarea.


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
  •