JSFiddle - React, Tailwind, and code Playground

by maxisam

HTML

<div >
<input type='checkbox' name='ch1'>
    This text must change !!!
<input type='checkbox' name='ch2'>
    </div>

JavaScript

$(function(){
    $('input:checkbox').parents().contents().filter( function(index){return (this.nodeType === 3 && $('input:checkbox').parents().contents().eq(index-1).attr('name') === 'ch1' ); }).remove();
});