:headerS2C 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 '#main' division of the page.


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

Press the button below to action the above code:


go to home page Homepage go to top of page Top