Search code examples
jqueryajaxwordpresszclip

zclip not working with ajax loaded content


I have a wordpress site. I want to add a copy to clipboard button in all post in a listing. In post, the copy to clipboard is included in ajax loaded content. Zclip is working fine in normal content, not in ajax content.


Solution

  • example code

    jQuery('.ajax_area').load('ajax_test_file.php', function() {
                    jQuery('a.copy-description').zclip({
                    path: '<?php bloginfo('template_url'); ?>/js/ZeroClipboard.swf',
                    copy: function() {
                        return jQuery(this).find('p.description:first').text();
                    }
                });
    }