Using jQuery. I have the following html:
<input type="checkbox" name='something' value='v1' /> All the world <br />
How would I get ONLY the text. what selector should I use? (I need the "All the world")
I also can not touch the HTML...
Try using the DOM function .nextSibling to pick the next node (including the text nodes) and use nodeValue to get the text All the world
.nextSibling
nodeValue
All the world
$(':checkbox')[0].nextSibling.nodeValue
2.1m questions
2.1m answers
60 comments
57.0k users