« Back to the index

WA.get, direct access to nodes examples


There are 2 methods to access the nodes fetched by the get:
WA.get.node() : returns the FIRST DOM node found.
WA.get.nodes() : returns ALL the DOM nodes found in an array.

Let's play with some objects:
function test1() { // We put a solid 2 pixels black border on every nodes with class "cd1" var nall = WA.get('.cd1').nodes(); for (var i = 0, l = nall.length; i < l; i++) nall[i].style.border = '2px solid black'; // We fill the node with id="d1" with 'XX' var nunique = WA.get('#d1').node(); nunique.innerHTML = 'XX'; // We change the coordinates of nodes with ids "d2" and "d3" WA.get("#d2").node().style.left = '170px'; WA.get("#d3").node().style.left = '190px'; }
Show the result



« Back to the index