Home >>jQuery Tutorial >jQuery * Selector

jQuery * Selector

jQuery Star(*) Selector

jQuery Star(*) selector in jQuery is used to selects all elements in the document, including html, head and body, it selects all child elements within the specified element.

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

<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
$("*").css("background-color", "pink");
});
</script>
</head>
<body>
<h1>Welcome to My Phptpoint</h1>
<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>PHP</li>
<li>jQuery</li>
</ul>
</body>
</html>

Output:

Welcome to My Phptpoint

My name is phptpoint

I live in Noida.

Who is your favourite:

  • Java
  • PHP
  • jQuery

No Sidebar ads