Jquery USES the jquery.zclip plug in to copy an example tutorial of an object

  • 2020-03-30 00:45:04
  • OfStack


<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="js/jquery.zclip.min.js"></script>


$(function(){
    $('#copy_input').zclip({
        path: 'js/ZeroClipboard.swf',
        copy: function(){//Duplicate content
            return $('#mytext').val();
        },
        afterCopy: function(){//Copy success
            $("<span id='msg'/>").insertAfter($('#copy_input')).text('Copy success');
        }
    });
});

It is worth noting that if the content is copied from input box, textarea, etc., the copy object is used:


copy: function(){
    return $('#mytext').val();
}

If the copied content comes from the page element div, p, etc., the copy object USES:


copy: $('#mytext').text();


Related articles: