iLTC Home
Bookmark iLTC!
iLTC Google Boards

Google Groups
Receive The Code in Email!



Categories

Perl
  • Perl Tutorials Beginners

    Javascript
  • Javascript Tutorials
  • Javascript Tutorials Beginners

    HTML
  • HTML Tutorials



  • I love the code... dot com
    20,083

    iLoveTheCode.com
    Javascript > Javascript Tutorials How To Easy > Select All or Highlight Text Fields and Textareas Using Javascript

    Select All or Highlight Text Fields and Textareas Using Javascript



    To select all or highlight text fields and textareas using Javascript:




    <textarea onClick=select()>This is some text.</textarea>
    <input type=text onClick=select() value="This is text too.">


    -We created a textarea and a text field.
    -We used Javascript's built-in onClick event handler.
    -We used Javascript's built-in select method to highlight the text.


    NOTES: Many times this is convenient for allowing users to copy and paste. Keep in mind, the select method prevents the user from editing the text in place. If the user tries to type, they will delete the highlighted text, which might be the desired effect.

    If you want to prevent typing, using HTML's readonly like so:


    <input type=text onClick=select() value="This is text too." readonly>



    Free Copy and Paste Javascript Code:

    <form>
    <textarea onClick=select() readonly>This is some text.</textarea>
    <input type=text onClick=select() value="This is text too." readonly>
    </form>



    Resources:
    Use onClick in Javascript



    Click HERE to comment or discuss at iLoveTheCode GOOGLE Group
    Previous Article: Close Window with window.close in Javascript
    Next Article: Focus a Window with self.focus in Javascript





    jQuery in ActionjQuery in Action

    Bear Bibeault, Yeh...

    New $26.39

    Struts 2 in ActionStruts 2 in Action

    Don Brown, Chad Da...

    New $29.69

    Pro CSS and HTML Design ...Pro CSS and HTML Design Patterns

    Michael Bowers

    New $29.69

    CSS MasteryCSS Mastery

    Andy Budd, Simon C...

    New $23.09

    DojoDojo

    Matthew A. Russell...

    New $26.39

    CSSCSS

    David McFarland

    New $23.09

    JavaScriptJavaScript

    David Flanagan

    New $31.49

    Dreamweaver CS3Dreamweaver CS3

    David McFarland

    New $29.69

    Creating Web SitesCreating Web Sites

    Matthew MacDonald

    New $19.77


    Of Interest:
  • Delete a File Using unlink in Perl
  • Write a WHILE LOOP in Perl, Carefully
  • INCREMENT and DECREMENT a Variable in Perl
  • Substitute in Perl
  • Get Query String Using Javascript
  • Get String Length with Javascript
  • Substitute in Javascript Using replace Method
  • Javascript Superscript Text
  • HTML Superscript Text
  • HTML Tables
  • HTML Image
  • HTML Space

  • More Articles:
  • Substitute in Perl
  • Exit a Loop with Last
  • Create an Array of Specific Numbers in Perl
  • Matching with a Regular Expression, REGEX, in Perl
  • onClick Javascript
  • If, Else If, and Else in Javascript
  • Get String Length with Javascript
  • Splitting an Array using Javascript
  • Getting Epoch Time in Javascript
  • Make a New Paragraph Using HTML
  • HTML Subscript Text
  • HTML Background
  • HTML Underline Text

  • Search iLTC w/ Google





    Recent Articles

  • Javascript Focus Form Field
  • Javascript Lowercase Text
  • Javascript Uppercase Text
  • Javascript Superscript Text
  • Javascript Subscript Text
  • Make Text Blink Using Javascript
  • Make a String into a Link in Javascript
  • Javascript Italics Text
  • Javascript Bold Text
  • Javascript Redirect
  • HTML Frames
  • HTML Color Chart
  • HTML Link
  • Javascript Status Bar








  • Perl Programming - Javascript Programming - Maybe Some PHP - Free Scripts - ILoveTheCode
    All Content © 2006 iLoveTheCode.com


    Contact Chris | About this Site


    316,823
    Counter by iLoveTheCode.com


    Last Modified: Friday, 23-Jun-2006 07:23:17 EDT