Contacto

C/Adresadors, 13 - 2º · 46001 Valencia ·
tel: 902 887 085 ·
fax: 96 045 00 36
info@ecran.es
17/07 2007

cssQuery ¿quién necesita getElementsByTagName?

Por Fernando Igual 1 comentario

cssQuery es una función javascript que busca elementos por su ruta CSS.
Compatible con todos los navegadores.

Veamos algunos ejemplos:


// find all paragraphs that are direct descendants
// of the document body
var tags = cssQuery("body > p");

// find all elements with the "href" attribute
var tags = cssQuery("[href]");


// find all anchor elements with "href" equal to "#"
var tags = cssQuery("a[href='#']");

// find all images contained by the above anchors
var images = cssQuery("img", tags);

// find all lists
var tags = cssQuery("dl,ol,ul");

// query an external xml document
var tags = cssQuery("my|:root>my|link", myXMLDoc);

// just plain complicated
var complex = "p>a:first-child+input[type=text]~span";
var tags = cssQuery(complex)

http://dean.edwards.name/my/cssQuery/

Una Respuesta a “cssQuery ¿quién necesita getElementsByTagName?”

  1. Nacho Ferrer dice:

    Esto esta de puta madre

Deja un comentario

Síguenos en LinkedIn, Facebook y Twitter Síguenos en LinkedIn Síguenos en Twitter Síguenos en Facebook