Home >>jQuery Tutorial >jQuery :header Selector

jQuery :header Selector

jQuery :header Selector

jQuery :header selector in jQuery is used to selects all header elements (<h1> to <h6>).

Syntax:
$(":header")
Here is an Example of jQuery :header Selector

<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
$(":header").css("background-color", "orange");
});
</script>
</head>
<body>
<h1>Welcome to Phptpoint</h1>
<h2>My Fantastic phptpoint</h2>
<h3>It's amazing!</h3>
<p class="intro">My name is phptpoint.</p>
<p>I live in Noida.</p>
<p>Who is your favourite:</p>
<ul id="choose">
<li>JAVA</li>
<li>jQuery</li>
<li>Javascript</li>
</ul>
</body>
</html>

Output:

Welcome to Phptpoint

My Fantastic phptpoint

It's amazing!

My name is phptpoint.

I live in Noida.

Who is your favourite:

  • JAVA
  • jQuery
  • Javascript