Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

copy all text with one click

Posted on 2004-04-17
2
219 Views
Last Modified: 2008-03-06
Can anyone a specific task I'm trying to achieve.

I have a form with a text box. Currently if user wanted to copy all the text in the textbox, they would have to highlight all the text and right click and select copy.  

I'd like to give the user the ability to copy all text with one click.

thanks,

john
0
Comment
Question by:jjbarnsley
2 Comments
 
LVL 12

Accepted Solution

by:
venkateshwarr earned 500 total points
ID: 10849769
Javascript would be enought..

<SCRIPT LANGUAGE="JavaScript">

function CopyText()
{
   r=document.forms[0].text_area.createTextRange();
   r.select();
   r.execCommand('copy');
}

</SCRIPT>
<center>
<form name="select_all">

<input type=text name="text_area" rows="10" cols="80" value="1 2 3 ">

<br>
<input type="button" value="Highlight & Copy Text"  onClick="javascript:this.form.text_area.focus();this.form.text_area.select();CopyText()">

</form>
</center>
0
 

Author Comment

by:jjbarnsley
ID: 10849773
thanks I'll try that.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question