I want to add a line by cutting the text with the wrap('<strike>')
tag via JQuery. The problem is that I need to select the P and SPAN tags that are inside the media-body DIV class, but only when the checkbox that is inside the media-left DIV is selected.
<div class="media">
<div class="media-left media-middle">
<label class="custom-control custom-checkbox m-l-1">
<input id="task" name="task" type="checkbox" class="custom-control-input" />
<span class="custom-control-indicator"></span>
</label>
</div>
<div class="media-body">
<p class="notice-date">Data</p>
<span>Uma nota qualquer</span>
</div>
$('input[id="task"]:checked').each(function() {
$(this).closest('.notice-date').wrap('<strike>'); });
I tried some codes like the one above and I did not succeed.