www.webdeveloper.com
Results 1 to 2 of 2

Thread: Copy text field value and allow paste in any oher page

  1. #1
    Join Date
    Jan 2011
    Posts
    3

    Thumbs up Copy text field value and allow paste in any oher page

    Hi

    I need to copy the value of read only text box from first HTML on button click then i need to paste it to any other text box in second html.

    could you please assist me in this regard

  2. #2
    Join Date
    Jan 2011
    Posts
    3
    I did this...

    add following code under <script> tag
    function copyText() {
    var textVal = document.getElementById('copytext').value;
    if(window.clipboardData && clipboardData.setData ) {
    window.clipboardData.clearData();
    window.clipboardData.setData("Text", textVal );
    }

    html code:
    <input type="text" value="hello world!" name="copytext" id="copytext" />
    <input type="button" value="Copy" onClick="copyText();">

    This script copies the text to clipboard and allows us to paste the text any where .this will work for IE browser.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles