Hide text but not input inside a label jquery

html, javascript, jquery

Solution

Replace the labels contents with just the checkbox.

var l = $('label[for=FormField_29_0]');
l.html(l.find('input'));

Problem

I have a label and input outputted from the shopping cart we are using. I don't want to hack the core of the cart to change the way it outputs. So the code is thus with the input inside the label: ``` <div id="FormField_29" class="FormField"> <label for="FormField_29_0"><input type="checkbox" id="FormField_29_0" name="FormField[2][29][0]" value="Yes" class="subscribeBox FormFieldOption" /> Yes</label> </div> ``` I am trying to hide the word "yes" in the label, but I can't seem to select it. It's not a sibling of the input since it's a label. And if I select parent not input it still makes the whole label with the input disappear. I tried next and it won't select it, since `DOM`-wise the text isn't really next... I can't use orphan since it's not an orphan being a part of label. What am I missing? Thanks!

Original source