[英]jQuery code doesn't work in CodeIgniter
I'm trying to do following with jQuery: 我正在尝试使用jQuery:
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script>
$('#test').hover(function(){
alert('sub');
});
</script>
</head>
Thanks. 谢谢。
I'm assuming that HTML DOM element with id="test"
exists. 我假设存在id="test"
HTML DOM元素。
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script>
$(function() {
$('#test').hover(function() {
alert('sub');
});
});
</script>
</head>
By the way, CodeIgniter has nothing to do with your issue. 顺便说一句,CodeIgniter与您的问题无关。
Seems like you are accessing an element which does not exists. 似乎您正在访问不存在的元素。
Try this: 尝试这个:
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script>
$(document).ready(function() {
$('#test').hover(function() {
alert('sub');
});
});
</script>
</head>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.