JQuery select text next to an input checkbox?
https://stackoverflow.com/questions/2542463
Solution
Better solution might be to wrap the text in a label
element:
<li>
<input type="checkbox" id="cbx1" value="10" />
<label for="cbx1">Very important text.</label>
</li>
You can then get the text like so:
var text = $('label[for="cbx1"]').text();
This also improves the semantics of your document.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow