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

176
Vistas
What is $(.some-class:#some-hash) in jQuery?

I'm studying this article, the details of which are irrelevant to this question, which is about jQuery syntax.

In the example at the link above, there's the following piece of JavaScript

$(function() {
  // ...
  var tabPostFix = 'Tab';
  var hash = location.hash;
  if (hash.length > 0) {
    // ...
    var idx = $('.tabPage').index($(".tabPage:"+hash+tabPostFix));
    var thisTab = $('.tab:eq('+idx+')');
    // ...
  }
  // ...
});

where tabPage and tab are classes in HTML file.

Despite I was under the impression that the "dollar syntax" of jQuery used CSS syntax, I eventually found that the syntax $('.tab:eq(some-number)') is indeed valid jQuery syntax, even though it isn't CSS syntax, is it?

On the other hand, I haven't found what $('whatever:#some-hash'). Given the example, I think the .index method is trying to pick the HTML element with class tabPage and id attribute the result of hash+tabPostFix (well, without the leading #), but I don't get the significance of the : right after tabPage.

about 4 years ago · Juan Pablo Isaza
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