Jose Gallo Jose Gallo - 1 year ago 66
HTML Question

I can't delete pure text using Jquery

I have error message on the page that I want to delete using Jquery while the error is getting fixed.

I can delete all the

tags but I have some elements that are only pure text and I can't figure it out.

Any help, will be appreciate

This is the html:

<body class = "">
": Undefined variable: output in "
" on line "

And this is the Jquery I delete all the text inside the b tags, but not the pure text:

$(document).ready(function() {
$("b, b:nth-child(2), b:nth-child(3), b:nth-child(4)").css( "display", "none" );

Many thanks

Answer Source

Try this if you have no other text nodes as body childs:

$('b:eq(0), b:eq(1)').remove();
var contents = $('body').contents().filter(function() {
    return this.nodeType == 3;
<script src=""></script>
":  Undefined variable: output in "

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download