get the text from an input radio button
I am befuddled about how to get the text label from a radio button. I have several radio buttons, like the following, and one of them is always checked.
<label><input type="radio" id="US" name="country" form="rentDataInput" value="US" />United States</label>
I want jQuery to get the text, i.e., United States, in the above example from the checked radio.
I've tried a bunch of things using text(), but recently found in the documentation that text() does not work with inputs. After more poking about, it seems that content() grabs the text out of inputs, but I don't get how to use that method from the documentation.
Here are a bunch of things I've tried. None work. The alert should return |, United States|
//var toRemoveCountry = ', ' + $("input[type='radio']:checked").text();
//var toRemoveCountry = ', ' + $('input[name=country]:checked + label').text();
//var toRemoveCountry = ', ' + $( "input:radio[name=country]:checked" ).text(); //with val() get US
//var toRemoveCountry = ', ' + $( "input:radio[name=country]:checked+label" ).text();
//var toRemoveCountry = ', ' + $( "input:radio[name=country]:checked+label" ).prop('text'); //get undefined
//var toRemoveCountry = ', ' + $( "input:radio[name=country]:checked+label" ).children().next('label').text(); //get undefined
var toRemoveCountry = ', ' + $( "input:radio[name=country]:checked+label" ).contents().text();
alert('|'+toRemoveCountry+'|'); //test returns |, | with text() or |, undefined| with html()
How do I get |, United States| in the alert() test?