jQuery无法单击单选按钮 [英] jQuery not working on clicking radiobutton

查看:24
本文介绍了jQuery无法单击单选按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的代码:

$(document).ready(function(){
    alert("document ready");

    $("input[type=radio]").click(function(event){
        alert("clicked");
    });
});

但是没有显示警报...而且,在控制台上输入时:
$(document).ready(function(){ alert("document ready");}) 我收到警报了!这是怎么回事?

But no alert shows up... And, when typing in on the console:
$(document).ready(function(){ alert("document ready");}) I get the alert! What is going on here?

推荐答案

我找到了解决方案,它也解释了为什么它在 JSFiddle 中有效.
问题是我如何导入 jQuery:我做到了

I found the solution, it explains as well why it does work in JSFiddle.
The problem was how I imported jQuery: I did

<script type="text/javascript" src="jQuerylink"/>

它必须是

<script type="text/javascript" src="jQuerylink" ></script>

我不知道为什么会这样,但现在可以了.感谢所有的努力.

I don't know why this is so, but now it works. Thanks for all effort.

这篇关于jQuery无法单击单选按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆