#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2013
    Posts
    37
    Rep Power
    1

    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 how its 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; December 24th, 2013 at 01:43 AM. Reason: To make things clear for the viewer
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2013
    Posts
    68
    Rep Power
    0
    Does it not work in all browsers? I know I've had trouble with copying and pasting with other tools in IE 10 and 11 where it would work fine in other browsers.
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2013
    Posts
    37
    Rep Power
    1
    Originally Posted by someGuyGatsby
    Does it not work in all browsers? I know I've had trouble with copying and pasting with other tools in IE 10 and 11 where it would work fine in other browsers.
    It doesnt work in IE and google chrome(the two browsers I use). So its useless if it aint working.
    That too, its not working when I put that thing inside a table, otherwise, its working fine.
    Do you have any other alternative solution or script for doing the same?

IMN logo majestic logo threadwatch logo seochat tools logo