Removing <link> element with jQuery?

前端 未结 4 1208
没有蜡笔的小新
没有蜡笔的小新 2020-12-10 03:45

I don\'t want to use styles from style.css, so I decided to remove style.css from DOM. This work just fine in Firefox and IE8, but not in IE6:

$(\"LINK[href=         


        
4条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-10 04:21

    Perhaps it's something strange IE6 does to URL in the href attribute? Try something like:

    $("LINK[href*='style.css']").remove();
    

    (i.e. check whether the href value contains "style.css")

    It's just a guess, however. If that doesn't work, I recommend checking the JQuery documentation closely on the subject of attribute selectors and the remove method.

    Also keep in mind that it's also not impossible that it's in fact a bug. (IE6 in general causes lots of issues involving JavaScript and DOM manipulation, among other things.)

提交回复
热议问题