How to render a plugin added dynamically?

后端 未结 3 1479
梦毁少年i
梦毁少年i 2021-01-26 09:21

This is my code :

HTML

相关标签:
3条回答
  • 2021-01-26 09:23

    Just call to FB.XFBML.parse after adding XFBML elements to page.

    You can also specify root node in which the XFMBL tags will be parsed.

    0 讨论(0)
  • 2021-01-26 09:27

    This should do the job:

    FB.XFBML.parse( document.getElementById("newFBContent"), function() {
        //plugin rendered
    });
    

    You should call FB.XFBML.parse after you've added the new content to the DOM.

    0 讨论(0)
  • 2021-01-26 09:34

    You missed one line, try:

    
    $('#addNewLink').click(function () {
        $('#newFBContent').html('<fb:like href="http://www.facebook.com" send="false" layout="button_count" width="auto" show_faces="true" font="" ></fb:like>')
    //and parse
            FB.XFBML.parse(document.getElementById('newFBContent'));
    
    });
    
    0 讨论(0)
提交回复
热议问题