このように:作業デモ http://jsfiddle.net/VtcPB/1/
よく読んでください:http://api.jquery.com/attribute-equals-selector/
また、@ Casperがgroup
使用について言ったように:$('input[name ="group1"]')
デモ http://jsfiddle.net/VtcPB/2/
または、代わりに 使用して、もう少し最適化されたhttp://jsfiddle.net/VtcPB/3/this.value
$(this).val()
またはより正確なデモを備えた別のもの:http ://jsfiddle.net/VtcPB/4/
お役に立てれば
コード
$("input:radio[name=group1]").click(function() {
alert($(this).val());
});
また
$('input[name ="group1"]').on('change',function(){
alert(this.value);
})
また
$('input[type="radio"]').on('change',function(){
alert($(this).val());
})
また
<input type="radio" name="group1" value="Milk"> Milk<br>
<input type="radio" name="group1" value="Butter"> Butter
$('input[type="radio"]').change(function(){
alert($(this).val());
})