yes, I can move elements, change all of its attributes and clone()...
but, what if I need to copy the element html code? what if I need to
save the code in a db? or export it to some other reason? or simply to
debug and show an alert with the element code?
my question isn't the need... is the possibility... can we do that?

BB, the contents() get all childNodes... through it, we can get the
html code? how?

I think in create a new div, insert the element in it, and get the
innerHTML or html() of the div...

have a better solution?


On Oct 9, 5:16 pm, BB <[EMAIL PROTECTED]> wrote:
> Maybe you want to do this with plain Javascript:
>
> $("#mydiv")[0].firstChild
> or:
> $("#mydiv").contents()[0];
>
> but .contents() get all childNodes from every element:
> $(".myclass").contents() would get the contents of every matched
> element (not like .html() wich only returns the innerHTML of the first
> matched element)
>
> On 9 Okt., 22:08, ricardobeat <[EMAIL PROTECTED]> wrote:
>
> > Why exactly do you need that?
>
> > You can move elements around without chaning it's code, like in
>
> > $('#myId').appendTo('.newposition');
>
> > You can also clone it and change all of it's attributes, so I don't
> > really see the need to get the elements code.
>
> > - ricardo
>
> > On Oct 9, 9:39 am, eudesf <[EMAIL PROTECTED]> wrote:
>
> > > I know that we can get the INNER html of an element with html()
> > > function.
> > > And also, we can get the parent() element and return this html()
> > > function to obtain the html code of the all children of the parent()
> > > element.
> > > But, how to get only, and only, the html code of the element that we
> > > have?

Reply via email to