Answer the question
In order to leave comments, you need to log in
JS script removing all p tags from a specific block?
Good
Let's say there is a block with id="outer"
And it is necessary that all tags inside it be deleted and
How will such a script look like? <p>
</p>
Answer the question
In order to leave comments, you need to log in
Maybe like this
HTML:
<div id="outer">
<p> бла бла </p>
<p> бла бла </p>
<p> бла бла </p>
<p> бла бла </p>
<p> бла бла </p>
<p> бла бла </p>
</div>
<input type="button" class="but" value="click">
$('.but').on('click', function () {
var $outer = $('#outer'),
$p = $outer.find('p');
$p.each(function () {
$(this).remove();
});
});
$("#outer").find("p").each(function(){
var $this = $(this);
$this.replaceWith( $this.html() );
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question