Get the entire string of a jquery DOM object

Posted by Scozzard on Stack Overflow See other posts from Stack Overflow or by Scozzard
Published on 2010-06-07T03:33:18Z Indexed on 2010/06/07 3:42 UTC
Read the original article Hit count: 238

Filed under:
|

Hi,

I have had a bit of a look around and am having some difficulty solving a wee issue I am having.

I basically have a string of HTML, I convert that to a JQuery DOM object so that I can easily remove all elements that have a certain class using JQuery's .remove(). I.e.,

var radHtml = editor.get_html();

var jqDom = $(radHtml);

$(".thickbox", jqDom).remove();

editor.set_html(jqDom.html());

The only problem is that .html() only gets the first element, not the entire DOM. In reference to my code I am basically wanting radHhtml - elements with class "thickbox" (returned as string).

I was wondering if there was an easy way to do this - have some html and remove all elements (in this case divs) that have a certain class (but leaving their contents). JQuery doesnt have to used, but I would like to.

Any help would be much appreicated. Thanks.

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about dom