jQuery Selectors: Selecting elements based on tags

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

In the earlier example, we have used * to select all elements.

We could specify multiple elements separated by comma.

The example here uses $(‘h4, p, a’).  Basically all elements that we could style in the page.

<!DOCTYPE html>
    <script src='//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js'></script>
        $(function () {
            $('h4, p, a').css('color', 'blue');

<p>Southernmost city in the world.</p>
<a href="http://en.wikipedia.org/wiki/Ushuaia">Visit us here.</a>

Series Navigation<< jQuery Selectors: Universal selector *
jQuery Selectors: Class and ID selectors >>