each time that you need javascript function you can use [0] or 'this' in your case you can get it by if(this.nodeName.toLowerCase() == "table") {
contentHtml += this.outerHTML(); } or if have already selected your table, $table = $('selector') use $table[0].outerHTML bittermonkey 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. > > -- View this message in context: http://www.nabble.com/Get-the-HTML-of-the-current-node-plus-its-Inner-HTML-tp24522580s27240p24524640.html Sent from the jQuery General Discussion mailing list archive at Nabble.com.