7
Vorrei aggiungere bit arbitrari di HTML (come <span>hello</span>
) a un elemento. Come faccio a farlo in Dart?Come aggiungere HTML arbitrario a un elemento di Dart?
Vorrei aggiungere bit arbitrari di HTML (come <span>hello</span>
) a un elemento. Come faccio a farlo in Dart?Come aggiungere HTML arbitrario a un elemento di Dart?
È possibile aggiungere i bit arbitrari di HTML per un elemento con appendHtml('<span>some html</span>')
, in questo modo:
import 'dart:html';
main() {
var elem = new DivElement();
elem.appendHtml('<span>hello</span>');
}
Il metodo appendHtml
analizzerà il codice HTML e aggiungere il nodo risultante come l'ultimo figlio dell'elemento.