Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jQuery remove h1 text

Tags:

jquery

text

i have this html line:

<nobr title="New" class="testClass">
       <h1>ABC</h1>
</nobr>

How can i remove the text inside h1 or remove the whole h1 tag?

my last try:

$("nobr.testClass > h1").text('');

But this dont work

like image 674
Alex Avatar asked May 08 '26 10:05

Alex


1 Answers

The following removes the h1 element:

$("nobr.testClass > h1").remove();

Though, your code should be working as written. Your error is elsewhere.

like image 126
Alex Avatar answered May 09 '26 23:05

Alex



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!