Loading table dynamically loses style rules

喜夏-厌秋 提交于 2019-12-25 06:56:08

问题


I am loading a page with table in a generated div in jquery. The loading goes fine, but the table loses its styles. I have tried to apply styles on the loaded page, on the landing page, and even inline styles on the table. The inline style works partially, like background color, but text doesn't allow me to change font type, size, weight.

$('<div/>', {
       id: 'newdiv',
       }).appendTo('body');

$('#newdiv').load('combi/page.with.table.php');

The table is simplified. No styles on tr or td.

<table style="font-size:x-large; font-family:'Courier New', Courier, monospace; text-align:right; background:#0F0" width="800" border="1" cellspacing="3" cellpadding="3">
    </table>

回答1:


If you are using a stylesheet to control the style of the table, make sure the stylesheet is in a path relative to the loaded page and not the page which is being loaded.



来源:https://stackoverflow.com/questions/9134451/loading-table-dynamically-loses-style-rules

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!