:header JQ Home  <<  Selectors  <<  :header

Header element selector.

Shorthand version $(':header')

Description

The :header selector, selects all header elements.

Being a jQuery extension the :header pseudo selector is not part of any current CSS specification. Therefore :header cannot take advantage of the performance boost provided by the native DOM querySelectorAll() method.

Syntax

Signature Description
jQuery(':header')Header element match

Parameters

None.

Return

N/A.

Selects all header elements.

In the example below we apply an orange background to all header elements within the '.content' division of the page.




$(function(){
  $('#btn21').on('click', function() {
    $(".content :header").css('backgroundColor', 'orange');
  });
});


Press the button below to action the above code:

Related Tutorials

jQuery Basic Tutorials - Lesson 4 - jQuery Selectors