Could you just say:
function innerHTML(node) {
var id = node.id;
$(this).parent().children().each(function() {
if ($(this).id == id)
return this;
});
}
and then just use what you need from there?
----- Original Message ----
From: Christian Bach <[EMAIL PROTECTED]>
To: [email protected]
Sent: Tuesday, April 10, 2007 6:15:50 AM
Subject: [jQuery] Re: outerHTML and Firefox does not work
You could try this, it's a bit sloppy.... but what the heck...
$.fn.outerHtml = function() {
$this = $(this);
var h = $this.html();
var s = $this.wrap("<div></div>").parent().html();
$this.empty().html(h);
return s;
};
<div id="A">
<div id="B">
<div>hello</div>
</div>
<div id="C">hello2</div>
</div>
alert($("#B").outerHtml());
/christian
2007/4/10, Fabien Meghazi <[EMAIL PROTECTED]>:
> Correct. Only Internet Explorer supports "outerHTML". Even "innerHTML"
> started off as a Microsoft only thing, but because it was used so
> widely other browsers have adopted it as a defacto standard.
>
> What are you trying to do that you need to use outerHTML?
Hi everyone in this thead, I was about to ask the same question when I
saw this thread. The problem is that no response has been given, so
let me ask again :
Is there a way to get the equivalent of outerHTML's result of a node
using jQuery ? (Y/n)
Got this:
<nodeA>
<nodeB id="test">
<nodeC/>
</nodeB>
<nodeD/>
</nodeA>
I would like this
$("#test").jquerymagic()
to return this :
<nodeB id="test">
<nodeC/>
</nodeB>
Same behaviour than $.html() but including the node's tag html too.
It's probably so basic that I must be blind and can't see the
evidence. Please, open my eyes.
Thanks.
--
POLYESTER*
Wittstocksgatan 2
115 24 Stockholm
Phone: 08-660 73 50 / +46-8-660 73 50
Mobile: 070-443 91 90 / +46-70-443 91 90
E-mail:
[EMAIL PROTECTED]
http://www.polyester.se