deleteRule method (CSSMediaRule, styleSheet)
Removes a rule from the current style sheet.
Note: The deleteRule method is supported in Internet Explorer from version 9.The cssRules collection represents both style rules and at-rules in a style sheet. The deleteRule method removes the CSSRule object at the specified position from the cssRules collection.
In older Internet Explorer versions, use the removeRule method for similar functionality. It removes a rule from the rules collection of a style sheet. The rules collection does not contains the at-rules. To remove at-rules, use the removeImport method for @import at-rules or modify the value of the cssText property for the others.
You can find the related objects in the Supported by objects section below.
|Required. Zero-based integer that specifies the position of the style rule to remove in the cssRules collection.|
This method has no return value.
Example HTML code 1:
This example illustrates the use of the deleteRule and removeRule methods:
Did you find this example helpful?
User Contributed Comments