Problem: I am trying to replace elements of a certain class with an empty string.
What i've tried
<table>
<tr>
<td>Cell to keep</td>
</tr>
<tr class='hide-report-item'>
<td>Remove Me</td>
<tr>
</table>
<script>
<!-- In my scenario data is actually a partial coming back from an ajax call) -->
function ParseData(data)
{
var foo = $(data)[2];
var hideItems = $(foo).find('.hide-report-item');
hideItems.each(function () {
var test = $(this)[0];
data = data.replace(test.outerHTML, '');
});
}
<!-- Ive also tried different variations of this -->
function ParseData(data)
{
var foo = $(data).find('.hide-report-item').hide();
var hideItems = $(foo).html();
}
<script>
Expected output:
<table>
<tr>
<td>Cell to keep</td>
</tr>
</table>
Any help would be appreciated. thanks