单选按钮上的jQuery单击事件不会被触发
问题描述:
我有以下代码来触发某些单选按钮上的点击事件!但它不会被解雇!谁能帮我这个!
I've got the following code to trigger a click event on some radio buttons! but it doesn't get fired! can any one help me with this!
代码:
$("#inline_content input[name='type']").click(function(){
if($('input:radio[name=type]:checked').val() == "walk_in"){
$('#select-table > .roomNumber').attr('enabled',false);
}
});
RADIO BUTTONS
<form class="type">
<input type="radio" name="type" checked="checked" value="guest">In House</input>
<input type="radio" name="type" value="walk_in">Walk In</input>
</form>.
更新
尝试 onChange()
也是如此。
答
它火灾。查看演示 http://jsfiddle.net/yeyene/kbAk3/
$("#inline_content input[name='type']").click(function(){
alert('You clicked radio!');
if($('input:radio[name=type]:checked').val() == "walk_in"){
alert($('input:radio[name=type]:checked').val());
//$('#select-table > .roomNumber').attr('enabled',false);
}
});