I'm working on a K-Mapping application for Electrical Engineering. However, I'm stuck on a single click function.
我正在研究一个电子工程的K-Mapping应用程序。但是,我被一个单击函数卡住了。
if(jQuery)
$(document).ready(function(){
$('a').click(function(){
alert("Evaluate Click Works");
var match = $(mintermIndexes).compare(ArrayOfEight);
if(match){
alert("All squares have been checked");
}
return false;
});
});
This is HTML,
这是HTML,
<div id="body">
<input id="Clear" value="Clear Form" type="submit" />
<a id="Evaluate" href="#" >Evaluate</a>
</div>
I really could use some help, I did share the only code that I think there is a problem. Please share your thoughts on how to fix this issue. Thanks.
我真的需要一些帮助,我分享了我认为唯一有问题的代码。请分享你对如何解决这个问题的想法。谢谢。
p.s : I tried almost every possible selector, but still nothing. There is no respond when i hit the link.
p。我试了几乎所有可能的选择器,但还是没有。当我点击链接时,没有回应。
EDIT: Changing the referencing order in the head tag worked, i.e i changed the order of my jquery app and jquery reference order. Thanks for the help anyway.
编辑:改变head标签中引用顺序的工作,我。e我改变了jquery应用程序的顺序和jquery参考顺序。谢谢你的帮助。
5 个解决方案
#1
1
I always encounter this problem. My solution is to put the script below the tag I want to manage. like this:
我总是遇到这个问题。我的解决方案是将脚本放在我想要管理的标记下面。是这样的:
<html>
<head>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js"></script>
</head>
<body>
<input id="Clear" value="Clear Form" type="submit" />
<a id="Evaluate" href="#" >Evaluate</a>
<script type="text/javascript">
$('a').click(function(){
alert("Evaluate Click Works");
var match = $(mintermIndexes).compare(ArrayOfEight);
if(match){
alert("All squares have been checked");
}
});
</script>
</body>
</html>
explanation:
解释:
you need to make sure that the "tag" is loaded first
您需要确保首先加载“标记”。
#2
4
Works fine:
工作正常:
http://jsfiddle.net/wCRLE/
Try removing the if (jQuery)
尝试删除if (jQuery)
Also, have you correctly referenced the jQuery
scripts?
另外,您是否正确地引用了jQuery脚本?
<script src="http://code.jquery.com/jquery.min.js" type="text/javascript"></script>
#3
1
Try this:
试试这个:
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function(){
$('a').click(function(){
alert("Evaluate Click Works");
var match = $(mintermIndexes).compare(ArrayOfEight);
if(match){
alert("All squares have been checked");
}
return false;
});
});
</script>
</head>
<body>
<div id="body">
<input id="Clear" value="Clear Form" type="submit" />
<a id="Evaluate" href="#" >Evaluate</a>
</div>
</body>
</html>
#5
0
Try getting rid of the if(JQuery)
尝试去掉if(JQuery)
Also, make sure you are loading JQuery before you load your content scripts. If you don't, nothing will happen.
此外,请确保在加载内容脚本之前已经加载了JQuery。如果你不这样做,什么也不会发生。
#1
1
I always encounter this problem. My solution is to put the script below the tag I want to manage. like this:
我总是遇到这个问题。我的解决方案是将脚本放在我想要管理的标记下面。是这样的:
<html>
<head>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js"></script>
</head>
<body>
<input id="Clear" value="Clear Form" type="submit" />
<a id="Evaluate" href="#" >Evaluate</a>
<script type="text/javascript">
$('a').click(function(){
alert("Evaluate Click Works");
var match = $(mintermIndexes).compare(ArrayOfEight);
if(match){
alert("All squares have been checked");
}
});
</script>
</body>
</html>
explanation:
解释:
you need to make sure that the "tag" is loaded first
您需要确保首先加载“标记”。
#2
4
Works fine:
工作正常:
http://jsfiddle.net/wCRLE/
Try removing the if (jQuery)
尝试删除if (jQuery)
Also, have you correctly referenced the jQuery
scripts?
另外,您是否正确地引用了jQuery脚本?
<script src="http://code.jquery.com/jquery.min.js" type="text/javascript"></script>
#3
1
Try this:
试试这个:
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function(){
$('a').click(function(){
alert("Evaluate Click Works");
var match = $(mintermIndexes).compare(ArrayOfEight);
if(match){
alert("All squares have been checked");
}
return false;
});
});
</script>
</head>
<body>
<div id="body">
<input id="Clear" value="Clear Form" type="submit" />
<a id="Evaluate" href="#" >Evaluate</a>
</div>
</body>
</html>
#4
#5
0
Try getting rid of the if(JQuery)
尝试去掉if(JQuery)
Also, make sure you are loading JQuery before you load your content scripts. If you don't, nothing will happen.
此外,请确保在加载内容脚本之前已经加载了JQuery。如果你不这样做,什么也不会发生。