我需要獲取使用jQuery選擇的radiobutton選項的值。我使用下面的代碼,但「海峽」螢火蟲未定義: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標記 – 2010-03-30 21:01:53
你能顯示相應的HTML代碼嗎? – 2010-03-30 21:02:40
您不需要名稱屬性選擇器中的引號。 '$(「input [name = rdoCheck]:checked」)'就足夠了。 – 2010-03-30 21:02:44