单选(radio)按钮点击事件


代码:
<div id="radio-button-div" style="display: inline;">
<fieldset data-role="controlgroup" data-type="horizontal" style="text-align: center; height: 50px;">
<input type="radio" name="radio-choice-h-2" id="radio-choice-h-2a" value="camera1" >
<label id="radio-camera1-label" for="radio-choice-h-2a">Camera 1</label>
<input type="radio" name="radio-choice-h-2" id="radio-choice-h-2b" value="camera2" checked="checked">
<label id="radio-camera2-label" for="radio-choice-h-2b">Camera 2</label>
</fieldset>
</div>

 

点击事件:
$("input[name=radio-choice-h-2]").click(function(){
switch($("input[name=radio-choice-h-2]:checked").attr("id")){
case "radio-choice-h-2a":
  alert(“click camera1");
break;
case "radio-choice-h-2b":
  alert(“click camera2");
break;
  default:
break;
}
});

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM