I am using this method to create custom thumbnails for embedded YouTube/Vimeo videos.
It is simple - image as placeholder, replace with embed when clicked.
My content is being generated through JSON $.getJSON and the click-binding appears not to catch. If I go through the console after the page has loaded and run my binding function, it works fine. So I think my problem is timing - I think that the click-binding is running before the content is generated. 
I've tried $( document ).ready() and I've tried using a callback (as seen below)
    function binding()
    {
    $('.portfolioVideoPlaceholder').click(function(){
                                var video = '<iframe src="'+ $(this).attr('data-video') +'"></iframe>';
                                $(this).replaceWith(video);
                                }
                        );      
    }
    function fillSection(callback)
    {
        $.getJSON('js/Mammola-portfilio-list.json', function (data){.......}
    callback(); 
    }
    fillSection(binding);
And my HTML for the placeholders looks like this:
    <img class="portfolioVideoPlaceholder" src="images/thumb-gpwit.png" data-video="//www.youtube.com/embed/WiOZdLFrbDE">
Any help would be appreciated.
 
     
     
    