jQuery Print function to print div content with css

前端 未结 4 968
难免孤独
难免孤独 2020-12-31 09:38

I\'ve this function for my Wordpress plugin uses jQuery that prints the content from the div with class \"table_disp\". How can I print the css style along with it.

4条回答
  •  南笙
    南笙 (楼主)
    2020-12-31 09:54

    You need to include the SAME stylesheet you're using in the parent page within the pop-up. You may want to make a dummy page stub/wrapper that has your stylesheet in it, then inject your HTML.

    var myStyle = '';
    w.document.write(myStyle + jQuery('.table_disp').html());
    

提交回复
热议问题