zclip within a function

135 views Asked by At

I never used zclip but after googling knew how to call zclip.

$("#copy").zclip({
    path: "js/ZeroClipboard.swf",
    copy: function(){
        return $(this).prev().val();
    }
});

But I have many buttons, they are working as share buttons. Clicking any button a function gets executed. I have to copy a string within the function.

function copy(commentId){
    var share_path = window.location.protocol + window.location.host + window.location.pathname + '#';
    share_path += <?='"'.$sharePath.'"';?> + commentId;
    //copy the string share_path
    alert(share_path);
}

How would you solve this? Please share with me.

1

There are 1 answers

0
whoone On BEST ANSWER

I just did this

prompt('Please copy this link to share', share_path);

Hope it'll also work for you.