开发者

Load file jQuery load with css inside the file

开发者 https://www.devze.com 2023-04-04 23:57 出处:网络
Imagine this small code $(document).ready(function() { $(\"#loadingDiv\").load(\"sub/__window_div.php\");

Imagine this small code

$(document).ready(function() {
    $("#loadingDiv").load("sub/__window_div.php");
})

It runs okay in Chrome开发者_Go百科, Firefox, Opera, Safari and IE8 (yes!). But if I add some CSS in the __window_div.php file, it stops running in IE8, but runs fine on other browsers.

I just add in the file those lines:

<style type="text/css">
</style>

Is it not possible to have CSS in the include file? Why only IE8 doesn't load the file?


  1. No, it is not valid to have <style></style> elements in any part of your HTML other than inside the <head></head> tags.

  2. Other browsers have managed to handle it, but as I said, the style element must be present only inside head tags.


You can not but in the body.

You should try to add your style directly in the tag with style="" attribute.

Or you should have your style included in the css of the calling page. The style will be applied on the loaded content.

0

精彩评论

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