124 views

select all the text from form element (eg. textarea,textbox)

To select content or text from form element:

use:

select();

Example:

  1. <script>
  2. function all_select_content()
  3. {
  4. document.getElementById(’select_all_content’).select();
  5. }
  6. </script>
  7. <textarea id="select_all_content" rows="5" cols="30">Select content from textarea just click the botton below.</textarea>
  8. <input type="button" name="button" value="Select all" onclick="all_select_content()">
  9.  

Demo:

Post a Comment

You must be logged in to post a comment.