Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to remove p tags within a div?

Tags:

jquery

I have a div which contains a paragraph tag which contains text. What I want is to remove the p tags but keep the text in the div? is this possible in jQuery?

<div id="footright"><p>Circus</p></div>
like image 687
Beginner Avatar asked Oct 29 '25 10:10

Beginner


2 Answers

There's lots of ways you can do it. I'd probably go with:

​$('#footright > p').contents().unwrap();​​​​​​​​​
like image 114
Andy E Avatar answered Nov 01 '25 12:11

Andy E


Yes:

$('#footright').text($('#footright').text());
like image 45
Thomas Kekeisen Avatar answered Nov 01 '25 14:11

Thomas Kekeisen



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!