jQuery在单击单选按钮时不起作用 [英] jQuery not working on clicking radiobutton
本文介绍了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屋!
查看全文