[GopherJS] Access Child Nodes of DOM Element


Access child nodes (childNodes) of DOM element via GopherJS.

import "github.com/gopherjs/gopherjs/js"

element := js.Global.Get("document").Call("getElementById", "foo")
childNodesList := element.Get("childNodes")
length := childNodesList.Get("length").Int()
for i := 0; i < length; i++ {
      // get i-th child
      child := childNodesList.Call("item", i)
      // do somthing to the child element here
}

References:

[1]GopherJS - A compiler from Go to JavaScript (GitHub, GopherJS Playground, godoc)
[2]