|
getting getElementById of dynamically added tr
hi all,
i'm building a tree using ajax to collect nodes by the onClick event to expand a parent node.
the base parent nodes are added via an ajax call and each row is assigned a numerical id.
then, when a parent node is clicked to expand and append the child nodes, I am trying to set the appendChild to the tr of the parent node, but it is coming up as a null.
here's psuedo code of flow:
onload ->
createTable: ajax call to return DS of top-level parent nodes
appendChild(row and cell), specify row id, add a plus button
to expand the children of each row
btn.onClick: ajax call to return DS of child nodes,
var row=document.getElementById(id of row selected)
row.appendChild(child row)
so, the question here is am I able to grab that getElementById of the parent row added in the createTable()?
let me know if you'd like to see the straight code, and thanks.
|