<< Click to Display Table of Contents >> Navigation: Navigation > JQuery and XPath |
THtDocument supports DOM queries using XPath and JQuery. Example:
for E in Document.JQuery('img') do ..
Returned list has the following properties and methods:
function GetCount: integer - count of nodes
function AddClass(const ClassName: string): IHtNodeList - add class
function RemoveClass(const ClassName: string): IHtNodeList - remove class
function ToggleClass(const ClassName: string): IHtNodeList; - toggle class
procedure Remove - delete nodes
property Nodes[Index: integer]: THtNode - node by index
property Attr[const Name: hstring]: hstring - attributes
property html: hstring - Inner HTML
property css[const Name: hstring]: hstring - CSS propeties
property Text: hstring - add or get node text
Calls can be chained, i.e.
JQuery('div').AddClass('some').CSS['color'] := 'green'];