开发者社区> 问答> 正文

引入jquery插件问题 报错 ?报错

html代码

 <!DOCTYPE html>
<html>
<head>
<script src="jquery.pagination.js"></script>
<script src="jquery-1.11.1.min.js"></script>
<script >
alert(1);
$('.M-box').pagination({

callback:function(index){
    $('.now').text(index);
}
},function(api){

$('.now').text(api.getCurrent());
});
</script>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
<div class="M-box"></div>
</body>
</html>

jquery.pagination.js和jquery-1.11.1.min.js文件都放项目下了
报错Uncaught ReferenceError: jQuery is not defined
43.html:8
Uncaught TypeError: $(...).pagination is not a function word_search.js:155
Uncaught TypeError: Cannot read property 'id' of null

发现jquery,js应该在第一行。。改了之后

Uncaught TypeError: Cannot read property 'id' of null 这个错啥意思。。

展开
收起
爱吃鱼的程序员 2020-06-23 00:03:38 488 0
1 条回答
写回答
取消 提交回答
  • https://developer.aliyun.com/profile/5yerqm5bn5yqg?spm=a2c6h.12873639.0.0.6eae304abcjaIB

    放入domready中,要不找不到对象

    $(function(){$('.M-box').pagination({callback:function(index){$('.now').text(index);}},function(api){$('.now').text(api.getCurrent());});})
    2020-06-23 00:03:55
    赞同 展开评论 打赏
问答分类:
问答地址:
问答排行榜
最热
最新

相关电子书

更多
23-Vue.js在前端...1506518547.pdf 立即下载
JS 语言在引擎级别的执行过程 立即下载
利用编译将 Vue 组件转成 React 组件 立即下载