Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7968269
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T07:03:01+00:00 2026-06-04T07:03:01+00:00

I am trying to delete the first css rule. However, this does not work

  • 0

I am trying to delete the first css rule.

However, this does not work in Firefox 3.6.28. Is this the same for everyone and why is this the case?

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
    <head>
        <title>Test</title>
        <meta http-equiv="Content-Type" content="text/html;charset=utf-8" >
        <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
        <script type="text/javascript">

            $(window).load(function(){

                console.log(document.styleSheets);
                document.styleSheets[0].deleteRule(0);
                console.log(document.styleSheets); // same as the first console.log

            });

        </script>
        <style>
            body{font-size:62.5%;}
            #mc{padding:310px 0 10px 162px; color:#fff;}
            #content{width:500px;}
            #header{padding-top:10px;}
            #banner{padding:10px 0}
        </style>
    </head>
    <body>
        Test JS
    </body>
</html>

Update

Just to clarify, the delete seems to be working however the console.log shows the same number of rules before and after the delete.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T07:03:02+00:00Added an answer on June 4, 2026 at 7:03 am

    Seems to work just fine for me

    example at http://jsfiddle.net/gaby/JmWwM/

    you need to check the length of the cssRules property.

    If you log the actual object in firebug then when you try to dig deeper it will show you the current state of the stylesheet, so it will have a reduced number of rules.. (since by the time you start digging the deletion will have occured)

    but if you log the actual number of rules before and after the deletion then it will show the correct results..

    so the problem is a mistake in understanding how the console.log command works.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to delete part of a string that does not match my
I'm trying to delete the first two lines of a file by just not
Question I am trying to use a button to delete the first entry to
I am trying to delete a row using the DataTables plugin. First I don't
im trying to delete this origin thing so i can actually run the tutorial
I'm trying to delete whole linked list but getting segmentation fault and not able
I am trying to delete an existing database in SQL Server 2005. My first
I'm simply trying to delete a row from a DataGridView. Basically, the first column
I'm trying to delete all foreign keys of a table. First I get all
I'm trying to find a way to delete the first match of a certain

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.