0

在一個頁面中,我顯示了所有圖像與一個類別。單擊單選按鈕顯示圖像使用jQuery Mobile

$("input[name$='pets']").click(function() { 
 
     var test = $(this).val(); 
 

 
     $("div.desc").hide(); 
 
     $("#flowers" + test).show(); 
 
    }); 
 
\t }); \t \t
 
 
<label> 
 
<input type="radio" name="pets" value="2" id="radio-choice-0a">Pets 
 
</label> 
 
<label> 
 
<input type="radio" name="flowers" value="3" id="radio-choice-0b">Flowers 
 
</label>

這是我的選擇。當點擊寵物選項時,寵物圖像將會顯示。否則禁用

+1

歡迎SO,這不是#2是如何工作的,你需要證明你有什麼到目前爲止已經試過,檢查此更好地理解它http://stackoverflow.com/help/how-to-ask – dreamweiver

+0

究竟是什麼問題是什麼? – dreamweiver

+0

我試過並修復它。謝謝 –

回答

0

$( 「輸入[名$ = '寵物']」)點擊(函數(){ 變種測試= $(本).VAL();

$("div.desc").hide(); 
    $("#flowers" + test).show(); 
}); 
}); 

$("input[name$='pets']").click(function() { 
 
     var test = $(this).val(); 
 

 
     $("div.desc").hide(); 
 
     $("#flowers" + test).show(); 
 
    }); 
 
\t }); \t