0
ID謹在此提醒當我點擊他們每個人的單選按鈕的名稱。但條件中只有一個單選按鈕。請幫忙。在jQuery的即時通訊新單選按鈕選擇
<html>
<head>
<style type="text/css">
#container{
width:500px;
height:300px;
background-color:#F9F9F9;;
}
</style>
<script type="text/javascript" src="jquery-1.6.1.js"> </script>
<script type="text/javascript">
$(document).ready(function(){
$("input[@name=testGroup]:checked").click(function(){
if($(this).val() == "pizza"){
alert("pizza");
}
else if($(this).val()== "cake"){
alert("cake");
}
});
});
</script>
</head>
<body>
<input type="radio" class="rad_but" name="food" value="pizza">Pizza</input>
<input type="radio" class="rad_but" name="food" value="cake">Cake</input>
<input type="radio" class="rad_but" name="food" value="others">Others</input>
<div id="container">
</div>
</body>
</html>
每次點擊他們每個人只有一個單選按鈕警報的值。請幫助
究竟..笏確實會改變嗎? – user978064 2012-04-28 16:00:55
您可以檢查它從這裏http://api.jquery.com/change/ – coder 2012-04-28 16:01:53
究竟做什麼,我簡化你的答案在這裏:http://jsfiddle.net/YWHM5/1/ – 2012-04-28 16:03:39