[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: $('div').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

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

2009-02-02 Thread boermans
On Feb 2, 9:14 pm, Andy789 e...@abcstudio.com.au 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

[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 frederik.r...@gmail.com 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
So you could just either wrap it in a dummy-div or add the div id=test and /div code manually?

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

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

[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?

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

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

[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 e...@abcstudio.com.au wrote: Hi All, I need to get html for a dom structure like this: div id=test div id=test2something/div img ../ /div if I use $('div#test').html(); it generates its

[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 ricardob...@gmail.com wrote: Try this: http://yelotofu.com/2008/08/jquery-outerhtml/ On Feb 2, 7:13 am, Andy789 e...@abcstudio.com.au wrote: Hi All, I need to get