[jQuery] Re: How to get html string including the selected element

2009-02-02 Thread Ricardo Tomasi
Oops, wrong URL. This is the right one: http://plugins.jquery.com/project/outerhtml On Feb 2, 9:59 pm, Ricardo Tomasi wrote: > Try this: > > http://yelotofu.com/2008/08/jquery-outerhtml/ > > On Feb 2, 7:13 am, Andy789 wrote: > > > Hi All, > > > I need to get html for a dom structure like this:

[jQuery] Re: How to get html string including the selected element

2009-02-02 Thread Ricardo Tomasi
Try this: http://yelotofu.com/2008/08/jquery-outerhtml/ On Feb 2, 7:13 am, Andy789 wrote: > Hi All, > > I need to get html for a dom structure like this: > > > something > > > > if I use > > $('div#test').html(); > > it generates its innerHTML excluding > > How an I get the whole structure

[jQuery] Re: How to get html string including the selected element

2009-02-02 Thread jQuery Lover
You can use .remove() to remove it from the DOM, just to be in safe side like this: $('').append($('#top').clone()).remove().html(); I explained the workaround in my blog post: http://jquery-howto.blogspot.com/2009/02/how-to-get-full-html-string-including.html On Mon, Feb 2, 2009 at 3:20 PM,

[jQuery] Re: How to get html string including the selected element

2009-02-02 Thread boermans
On Feb 2, 9:14 pm, Andy789 wrote: > Thank you. I think it should work - I will give it a try tomorrow. The > whole mess is just to store these html strings in the database and > extract it later to render a part of the page. > > any better solutions for this? > I suppose the significant factor i

[jQuery] Re: How to get html string including the selected element

2009-02-02 Thread Andy789
Thank you. I think it should work - I will give it a try tomorrow. The whole mess is just to store these html strings in the database and extract it later to render a part of the page. any better solutions for this? On Feb 2, 9:20 pm, boermans wrote: > On Feb 2, 7:50 pm, Frederik Ring wrote: >

[jQuery] Re: How to get html string including the selected element

2009-02-02 Thread boermans
On Feb 2, 7:50 pm, Frederik Ring wrote: > So you could just either wrap it in a dummy-div or add the id="test"> and code manually? Something like this should do the trick. $('').append($('#test').clone()).html(); Not sure if jQuery disposes of the new node and it’s cloned contents afterwards.

[jQuery] Re: How to get html string including the selected element

2009-02-02 Thread boermans
On Feb 2, 7:13 pm, Andy789 wrote: > I need to get html for a dom structure like this: > > $('div#test').html(); > > it generates its innerHTML excluding > > How an I get the whole structure including id test? Good question - although... What are you doing with the element once you have it?

[jQuery] Re: How to get html string including the selected element

2009-02-02 Thread Frederik Ring
So you could just either wrap it in a dummy-div or add the and code manually?

[jQuery] Re: How to get html string including the selected element

2009-02-02 Thread Andy789
Because the parent element for #test contains many other divs - not only #test. On Feb 2, 8:38 pm, Frederik Ring wrote: > Why can't you just read the html() of the element containing your > #test?

[jQuery] Re: How to get html string including the selected element

2009-02-02 Thread Frederik Ring
Why can't you just read the html() of the element containing your #test?