jQuery로 선택한 라디오 버튼 옵션의 값을 가져와야합니다. 다음 코드를 사용하고 있지만 "str"은 Firebug에서 정의되지 않았습니다.jQuery : RadioButton 선택을 잡는 방법?
//handling Feed vs. Ingredient RadioButton
$('[id$=rdoCheck]').change(function() {
str = $("input[name='rdoCheck']:checked").val();
//ingredients
if (str == "ing")
{ $('[id$="lblDescription"]').text("Ingredient") }
//finished feed
else if (str == "ffc")
{ $('[id$="lblDescription"]').text("Finished") }
});
HTML 마크 업 표시 –
해당 HTML 코드를 표시 할 수 있습니까? –
이름 속성 선택자에 따옴표가 필요하지 않습니다. '$ ("input [name = rdoCheck] : checked")'이면 충분합니다. –