mozilla
Your Search Results

    CSSStyleRule.selectorText

    Summary

    The CSSRule.selectorText property gets the textual representation of the selector for the rule set. This is implemented in a readonly manner; to set stylesheet rules dynamically, see Using dynamic styling information.

    Syntax

    string = cssRule.selectorText 
    

    Example

    // for cssrule: body { background-color: darkblue; }
    var stylesheet = document.styleSheets[0];
    
    alert(stylesheet.cssRules[0].selectorText); // body
    

    Notes

    The implementation may have stripped out insignificant whitespace while parsing the selector.

    Specification

    Document Tags and Contributors

    Contributors to this page: Sheppy, fscholz, miket, ethertank, Brettz9, JesseW, teoli, cuixiping, Dria
    Last updated by: cuixiping,