www.webdeveloper.com
Results 1 to 1 of 1

Thread: Copy To Clipboard Using ZeroClipboard Not Working In Table

  1. #1
    Join Date
    Jul 2013
    Posts
    31

    Copy To Clipboard Using ZeroClipboard Not Working In Table

    I'm using ZeroClipboard for making a copy to clipboard link in my website.
    Here is a small sample :
    HTML Code:
    <html>
        <head>
        </head>
        <body>
            <script type="text/javascript" src="jquery/js/jquery.js"></script>
            <script type="text/javascript" src="jquery.zclip.js"></script>
            <script type="text/javascript">
                $(document).ready(function(){
                    $('#copy-hc').zclip({
                        path:'ZeroClipboard.swf',
                        copy:$('#hc').attr('href')
                    });
                    $('#copy-ez').zclip({
                        path:'ZeroClipboard.swf',
                        copy:$('#ez').attr('href')
                    });
                    $('#copy-hcref').zclip({
                        path:'ZeroClipboard.swf',
                        copy:$('#hcref').attr('href')
                    });
                });
            </script>
            <a id="ez" href="http://domain.com/ez">Some text here!!!</a>
            <a href="#" id="copy-ez">Copy To Clipboard</a>
            <a id="hc" href="http://domain.com/hc">Some text here!!!</a>
            <a href="#" id="copy-hc">Copy To Clipboard</a>
            <table>
                <tr>
                    <td><a id="hcref" href="http://domain.com/hcref">hcref</a></td>
                    <td><a href="#" id="copy-hcref">Copy To Clipboard</a></td>
                </tr>
            </table>
        </body>
    </html>
    The first two copy to clipboard links are working absolutely prefect(id copy-ez and copy-hc)
    But, the third link which has id copy-hcref isn't working. I copied it and pasted it outside the table and its working perfectly, but as I put it inside the table, its not working.
    Here's a snippet of it working :
    HTML Code:
    <html>
        <head>
        </head>
        <body>
            <script type="text/javascript" src="jquery/js/jquery.js"></script>
            <script type="text/javascript" src="jquery.zclip.js"></script>
            <script type="text/javascript">
                $(document).ready(function(){
                    $('#copy-hc').zclip({
                        path:'ZeroClipboard.swf',
                        copy:$('#hc').attr('href')
                    });
                    $('#copy-ez').zclip({
                        path:'ZeroClipboard.swf',
                        copy:$('#ez').attr('href')
                    });
                    $('#copy-hcref').zclip({
                        path:'ZeroClipboard.swf',
                        copy:$('#hcref').attr('href')
                    });
                });
            </script>
            <a id="ez" href="http://domain.com/ez">Some text here!!!</a>
            <a href="#" id="copy-ez">Copy To Clipboard</a>
            <a id="hc" href="http://domain.com/hc">Some text here!!!</a>
            <a href="#" id="copy-hc">Copy To Clipboard</a>
            <a id="hcref" href="http://domain.com/hcref">hcref</a>
            <a href="#" id="copy-hcref">Copy To Clipboard</a>
        </body>
    </html>
    But I need it to work from within a table. Perhaps some help?
    Last edited by The Alchemist; 12-24-2013 at 01:41 AM. Reason: To make things clear for the viewer

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