Hinweise

Diese Seite demonstriert die Verwendung der Selectors API.

Der Internet Explorer 8 (Beta 1) stellt die Selectors API nur im IE 8 Modus zur Verfügung. Dieser Modus schließt allerdings die Verwendung eines Hacks aus, der es erlaubt unbekannten Elementen Stilangaben zuzuordnen. Das Layout dieser Seite ist deshalb fehlerhaft.

Beispielstruktur

I'm a header.

I'm a tagline. And I'm special!

I'm a section with the class intro and have the attribute contenteditable.
  • I'm the first child of ul.
  • I'm the second child of ul. And I'm special!.
  • Je suis français.
  • I'm the the last child of ul.
I immediately follow the section with the class intro.
I follow the section with the class intro and have the attribute contenteditable.

document.querySelector()

document.querySelector() gibt das erste Element des Dokument zurück, das die Kriterien des Selektors erfüllt.

document.querySelectorAll()

document.querySelectorAll() gibt alle Elemente des Dokuments zurück, die die Kriterien des Selektors erfüllen.