开发者

jQuery table.wrap() causes layout issues

I'll post a more detailed code snippet later (don't have VPN access right now) but is there anything usual that can cause strange layout issues in the case below:

<body>
    <div>...</div>
    <div>...开发者_开发问答</div>
    <div>...</div>
    <table id="container">...</table>
</body>

The top level <div>s are float: left; width: 100%

When I try to wrap the table using:

$('table#container').wrap('<div id="body_content"></div>');

The content of the first <div> gets messed up (seems to duplicate the menu bar I have there).

UPDATE Just found <script> tags like the following nested inside the table, when I remove those before wrapping the table the issue goes away. Any insight into this would be appreciated.

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js"></script>


Looks like the issue was nested <script> tags, in particular a nested tag which loaded jQuery. Removing the script tags before calling wrap() seems to fix the issue.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜