Element Child
From UBot Studio
(Difference between revisions)
| (5 intermediate revisions by one user not shown) | |||
| Line 1: | Line 1: | ||
$Element Child is a [[Browser Functions|Browser Function]]. | $Element Child is a [[Browser Functions|Browser Function]]. | ||
| − | This function returns the child of a selected element. | + | This function returns the child of a selected element. To understand what determines an element as the child of another element, please see [http://www.w3schools.com/js/js_htmldom_navigation.asp JavaScript HTML DOM Navigation] |
$element child gets the child html element of the one matched with the selector. | $element child gets the child html element of the one matched with the selector. | ||
| + | |||
| + | The [[The Selectors|Element Selector]] is used to select an item. | ||
| + | |||
| + | '''Element:''' The desired page element. | ||
| Line 9: | Line 13: | ||
<pre> | <pre> | ||
| − | + | load html("<html> | |
| − | set(# | + | |
| + | <head> | ||
| + | <title>DOM Tutorial</title> | ||
| + | </head> | ||
| + | |||
| + | |||
| + | <body> | ||
| + | <h1>DOM Lesson one</h1> | ||
| + | <p>Hello world!</p> | ||
| + | </body> | ||
| + | |||
| + | </html>") | ||
| + | set(#child, $scrape attribute($element child($element offset(<tagname="html">, 0)), "innertext"), "Global") | ||
| + | |||
</pre> | </pre> | ||
| − | The set command returns the | + | |
| + | The set command returns: "DOM Tutorial", which is the child of the selected tag HTML. | ||
Latest revision as of 16:19, 24 December 2013
$Element Child is a Browser Function.
This function returns the child of a selected element. To understand what determines an element as the child of another element, please see JavaScript HTML DOM Navigation
$element child gets the child html element of the one matched with the selector.
The Element Selector is used to select an item.
Element: The desired page element.
[edit] Example
load html("<html>
<head>
<title>DOM Tutorial</title>
</head>
<body>
<h1>DOM Lesson one</h1>
<p>Hello world!</p>
</body>
</html>")
set(#child, $scrape attribute($element child($element offset(<tagname="html">, 0)), "innertext"), "Global")
The set command returns: "DOM Tutorial", which is the child of the selected tag HTML.