{"name":"class","type":"selector","title":"Class Selector (\".class\")","deprecated":null,"removed":null,"desc":"Selects all elements with the given class. ","categories":["selectors/basic-css-selectors","version/1.0"],"entries":[{"return":"","signatures":{"added":"1.0","argument":{"desc":"A class to search for. An element can have multiple classes; only one of them must match.","name":"class","type":"String"}},"examples":[{"desc":"Finds the element with the class \"myClass\".","code":"\n$( \".myClass\" ).css( \"border\", \"3px solid red\" );\n","html":"\n
div class=\"notMe\"
\n
div class=\"myClass\"
\nspan class=\"myClass\"\n","css":"\n div, span {\n width: 120px;\n height: 40px;\n float: left;\n padding: 10px;\n margin: 10px;\n background-color: #EEEEEE;\n }\n"},{"desc":"Finds the element with both \"myclass\" and \"otherclass\" classes.","code":"\n$( \".myclass.otherclass\" ).css( \"border\", \"13px solid red\" );\n","html":"\n
div class=\"notMe\"
\n
div class=\"myClass\"
\nspan class=\"myClass\"\n","css":"\n div, span {\n width: 120px;\n height: 40px;\n float: left;\n padding: 10px;\n margin: 10px;\n background-color: #EEEEEE;\n }\n"}],"longdesc":"\n

For class selectors, jQuery uses JavaScript's native getElementsByClassName() function if the browser supports it.

\n "}],"slug":"class-selector"}