I am trying to skip all the elements in this div and display the results (C # code, which I will use later) on the screen for testing.
so if i have html like this:
<div id="testDiv"> <test> <a>aVal</a> <c> <cc>ccVal</cc> </c> </test> </div>
I am trying to create this string value:
HtmlElement.CreateNode("test").AddNode(CreateNode("a").addText("aVal")).AddNode(CreateNode("c").AddNode(CreateNode("cc").addText("ccVal"))
Right now I see this jquery in place, but I'm not sure how to expand the other nodes:
var x = "HtmlElement."; $('div#testDiv').children().each(function () { var nodeNameStr = this.nodeName.toLowerCase(); var nodeText = $(this).text(); x += "CreateNode(nodeNameStr).addText(nodeText)" });
some_bloody_fool
source share