我的代码:
$(document).ready(function(){
alert("document ready");
$("input[type=radio]").click(function(event){
alert("clicked");
});
});
但是没有出现任何警报...并且,在控制台上输入时:
$(document).ready(function(){alert("document readready");})
我收到警报!这是怎么回事?
最佳答案
尝试.change()而不是 .click()
$(document).ready(function(){
alert("document ready");
$("input[type=radio]").change(function(){
alert("clicked");
});
});
关于jQuery 无法点击单选按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9751035/