How to remove a – Richard Marskell - Drackir May 26 '11 at 21:20

  • yes i want that style block removed. i copy/pasted the HTML part straight from the source. no idea what the author was thinking by putting a style in an ul. – plastic cloud May 26 '11 at 21:31
  • 4 Answers4

    4

    have you tried:

    $('.menu2 style').remove();
    
    locrizak
    • 12,192
    • 12
    • 60
    • 80
    3

    If you keep the style block, then it should remained preserved. Use this to change the color:

    $('a').css("color", "#269");
    

    and this to change it back

    $('a').css("color", "");
    

    it should go back to the rule for an anchor tag rather than an inline style.

    Scott Harwell
    • 7,457
    • 2
    • 28
    • 41
    2

    You need

    $('.menu2 > style').remove();
    

    see demo here

    Jose Rui Santos
    • 15,009
    • 9
    • 58
    • 71
    1

    Use document.styleSheets to find all used style sheets and when the unwanted is found, set disabled to true.

    More information:

    1. https://developer.mozilla.org/en/document.styleSheets
    2. http://www.w3.org/TR/DOM-Level-2-Style/stylesheets.html#StyleSheets-StyleSheet

    As far as I can tell, it works in all modern browsers.

    edwin
    • 2,643
    • 20
    • 17