I have html like:
<label><input type="radio" /> Lorem</label>
What's the best way to change "Lorem" to "Ipsum"? These don't work:
// nope:
$('input').next().text('Ipsum');
// also nope:
var text = $('input').parent()[0].childNodes[1];
$(text).text('Ipsum');
I can easily change the html to:
<label><input type="radio" /><span> Lorem</span></label>
or use the replaceWholeText
DOM method directly:
$('input').parent()[0].childNodes[1].replaceWholeText(' Ipsum');
or any number of other things, but I'm wondering if there's a clean jQuery way to do this.