I had a little look around, and it is difficult for me to solve the problem associated with my problem.
I basically have an HTML string, I convert it to a JQuery DOM object so that I can easily remove all elements that have a specific class using JQuery.remove (). I.e.
var radHtml = editor.get_html(); var jqDom = $(radHtml); $(".thickbox", jqDom).remove(); $(".thickboxcontent", jqDom).remove(); editor.set_html(this.innerHTML);
NOTE. HTML is derived from the content in the RADEditor text editor, so there are no parent HTML tags, so it may look like this:
<p>This is a header</p> <p>this is some content followed by a table </p> <a href="#TB_inline?height=350&width=400&inlineId=myOnPageContent0" class="thickbox">Test Thickbox</a> <div id="myOnPageContent0" class="thickboxcontent"> <table class="modal"> <thead> </thead> <tbody> <tr> <td>item</td> <td>result</td> </tr> <tr> <td>item 1</td> <td>1</td> </tr> <tr> <td>item 2</td> <td>2</td> </tr> <tr> <td>item 3</td> <td>3</td> </tr> </tbody> </table> </div>
Here is what jqDom.html () returns from the HTML above:
"This is a header"
I was wondering if there is an easy way to do this - to have some html and remove all elements (in this case divs) that have a specific class (but leave their contents). JQuery does not need to be used, but I would like to.
Manipulating the DOM object is fine - it gets the entire DOM object as a string, with which I had a problem.
Any help would be very helpful. Thanks.
jquery dom
Scozzard
source share