Theordore, The function worked like a charm. Thanks man and for everyone who pitched in.
On Jul 16, 5:11 pm, Theodore Ni <zyl...@gmail.com> wrote: > I was going to work on a proof of concept, but then I had the idea to see if > anyone else has already implemented this. Sure enough, Brandon Aaron > has:http://brandonaaron.net/blog/2007/06/17/jquery-snippets-outerhtml > <http://brandonaaron.net/blog/2007/06/17/jquery-snippets-outerhtml> > Ted > > On Thu, Jul 16, 2009 at 3:06 PM, bittermonkey <brakes...@gmail.com> wrote: > > > Hi, > > > I need to get all the TABLE HTML code within the <body> tag for a > > content-generating application. I'm trying to use the html() method, > > but it only gets the inner HTML. I also tried clone(), but does the > > same thing. Or maybe I'm using it wrong. Here's an example to clarify > > what I wanted to do: > > > Input > > ==================================================== > > <body> > > <p>some text</p> > > <table cellpadding="0" cellspacing="0" style="width: 600px;">....</ > > table> > > <div>...</div> > > <table cellpadding="0" cellspacing="0" style="width: 400px;">....</ > > table> > > </body> > > > Output > > ==================================================== > > <table cellpadding="0" cellspacing="0" style="width: 600px;">....</ > > table> > > <table cellpadding="0" cellspacing="0" style="width: 400px;">....</ > > table> > > > jQuery Code > > ==================================================== > > $("body").children().each(function(){ > > var contentHtml = ""; > > if(this.nodeName.toLowerCase() == "table") > > { > > //need to include the <TABLE> code here > > contentHtml += $(this).html(); > > } > > }); > > > Thanks in advance.