JSFiddle - React, Tailwind, and code Playground

by David Thomas

HTML

<input type="checkbox" name='something' value='v1' /> All the world <br /> Something else (just to test).

JavaScript

var text = $('input:checkbox[name="something"]').parent().contents().filter(
    function(){
        return this.nodeType === 3 && this.nodeValue.trim() !== '' && $(this).prevAll('br').length === 0;
    }).text();

console.log(text);