W3cubDocs

/Dart 2

querySelector method

Element querySelector (String selectors)
override

Finds the first descendant element of this element that matches the specified group of selectors.

selectors should be a string using CSS selector syntax.

// Gets the first descendant with the class 'classname'
var element = element.querySelector('.className');
// Gets the element with id 'id'
var element = element.querySelector('#id');
// Gets the first descendant [ImageElement]
var img = element.querySelector('img');

For details about CSS selector syntax, see the CSS selector specification.

Implementation

Element querySelector(String selectors) native;

© 2012 the Dart project authors
Licensed under the Creative Commons Attribution-ShareAlike License v4.0.
https://api.dart.dev/stable/2.5.0/dart-html/Element/querySelector.html