Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

202
Vistas
What is the use of ("*") in jquery

I am reading jQuery, i don't know why use ("*") please explain it's helpful

<script>
    $(document).ready(function(){
        $("button").click(function(){
            $("*").hide();
        });
    });
</script>
over 4 years ago · Santiago Trujillo
3 Respuestas
Responde la pregunta

0

* is a selector in jquery which select everything without any condition including html, head and body.

Here is an example explaining its usage.

$(document).ready(function(){
    $("button").click(function(){
        $("*").hide();
    });
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div>
  Hello text
</div>
<button>Click Me to Hide everything</button>
* selector can be used with elements that it selects all child elements within the specified element. without any condition

$(document).ready(function(){
    $("button").click(function(){
        $("div *").toggle();
    });
});
div{
border:0.5px solid red;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div>
  <p>Hello text</p>
  <a>Here is a link </a>
</div>

<button>Click Me to Hide/ Show elements inside the div</button>

over 4 years ago · Santiago Trujillo Denunciar

0

$(*) is used to select all elements inside the document. Refer this: https://www.w3schools.com/jquery/sel_all.asp

over 4 years ago · Santiago Trujillo Denunciar

0

$(*) is a selector in jqueryto select all elements

and hence

$("*").hide(); will hide all elements

$(document).ready(function(){
    $("button").click(function(){
        $("*").hide();
    });
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div>Hello</div>
<p>World</p>
<span>Good Morning</span>
<button>Hide</button>

Docs

over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda