HTML issue - select all text?

by cotum
3 replies
  • WEB DESIGN
  • |
Hi, I'd like to be able to allow users to select all given text with one click, so if this is displayed:

1. "Click here to select blah blah blah"

2. "This is HTML"

the user would only have to click once to select #1, or if they click around #2 it would select all that.

Is this possible?
#html #issue #select #text
  • Profile picture of the author pixelnav_design
    Yes it is possible using the form tag of HTML
    Signature
    http://www.pixelnav.com : Pixelnav is an one stop solution provider for all your website and graphical needs.

    Skype ID : freelancer_ben
    {{ DiscussionBoard.errors[2109766].message }}
  • Profile picture of the author ninal
    Are they plain text? Or will it be contained within input textboxes/textareas?
    Signature
    Hello
    {{ DiscussionBoard.errors[2110073].message }}
  • Profile picture of the author pmrc
    put this inside the <head> tag:

    <SCRIPT LANGUAGE="JavaScript">
    <!-- Begin
    function copyit(theField) {
    var tempval=eval("document."+theField)
    tempval.focus()
    tempval.select()
    therange=tempval.createTextRange()
    therange.execCommand("Copy")
    }
    // End -->
    </script>

    Put this where you want your text to be and edit as necessary:

    <form name="it">
    <div align="center">
    <input onclick="copyit('it.select1')" type="button" value="Click to Copy the Text" name="cpy">
    <p>
    <textarea name="select1" rows="3" cols="25">
    ENTER TEXT HERE THAT YOU WOULD LIKE TO COPY AND PASTE.
    </textarea>
    </div>
    </form>
    {{ DiscussionBoard.errors[2110988].message }}

Trending Topics