jQuery Selectors: Selects elements that are of header type

This entry is part 29 of 33 in the series jQuery Selectors


Selects elements that are of header type such as <h1>,<h2>,<h3> and so on.

<!DOCTYPE html>
<head lang='en'>
    <meta charset='UTF-8'>
    <title>Codecrawl.com - HTML5</title>
    <script src='http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js'></script>
        $(function () {
            $(':header').css('background-color', 'yellow');


        <p>Ushuaia is the capital of Tierra del Fuego in Argentina</p>
        <p>It is commonly regarded as the southernmost city in the world.</p>

        <p>They also built a railway now a tourist attraction known as the End of the World Train</p>


Series Navigation<< jQuery Selectors: Filter out everything but the first element
jQuery Selectors: Selects element at specific zero-based index >>

Leave a comment

Leave a Reply