Aamir Shahzad Aamir Shahzad - 2 months ago 12
CSS Question

How to remove "<" special character between div and table with jQuery

As shown in the screenshot below, I want to remove unwanted

<
special characters.

NOTE: THIS IS NOT AN HTML ISSUE

I am trying get child nodes via method below but don't know how to remove them.

HTML

<div>
>
>
>
>
>
<table>
</table>
</div>


Javascript:

$('div')
.contents()
.filter(function(){
return this.nodeType === 3 && /\S/.test(this.nodeValue);
});


enter image description here

Answer

I'm not exactly sure the code/HTML you're dealing with, but I would do something like this:

$('div').text().replace(/</g, '');

demo

Comments