引入jquery插件问题

qq_28573739 2016-02-01 10:35:00
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 这个错啥意思。。
...全文
381 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
qq_28573739 2016-02-01
  • 打赏
  • 举报
回复
引用 3 楼 rui888 的回复:
 function pageselectCallback(page_index, jq){
                // Get number of elements per pagionation page from form
                var items_per_page = $('#items_per_page').val();
                var max_elem = Math.min((page_index+1) * items_per_page, members.length);
                var newcontent = '';

                // Iterate through a selection of the content and build an HTML string
                for(var i=page_index*items_per_page;i<max_elem;i++)
                {
                    newcontent += '<dt>' + members[i][0] + '</dt>';
                    newcontent += '<dd class="state">' + members[i][2] + '</dd>';
                    newcontent += '<dd class="party">' + members[i][3] + '</dd>';
                }

                // Replace old content with new content
                $('#Searchresult').html(newcontent);

                // Prevent click eventpropagation
                return false;
            }
上面的例子是个假的数据 应该根据后台来取数据。
这个代码哪找的= =我咋没看见那
tony4geek 2016-02-01
  • 打赏
  • 举报
回复
你可以参考这个 ,把url改掉。
tony4geek 2016-02-01
  • 打赏
  • 举报
回复
 function pageselectCallback(page_index, jq){
                // Get number of elements per pagionation page from form
                var items_per_page = $('#items_per_page').val();
                var max_elem = Math.min((page_index+1) * items_per_page, members.length);
                var newcontent = '';

                // Iterate through a selection of the content and build an HTML string
                for(var i=page_index*items_per_page;i<max_elem;i++)
                {
                    newcontent += '<dt>' + members[i][0] + '</dt>';
                    newcontent += '<dd class="state">' + members[i][2] + '</dd>';
                    newcontent += '<dd class="party">' + members[i][3] + '</dd>';
                }

                // Replace old content with new content
                $('#Searchresult').html(newcontent);

                // Prevent click eventpropagation
                return false;
            }
上面的例子是个假的数据 应该根据后台来取数据。
qq_28573739 2016-02-01
  • 打赏
  • 举报
回复
引用 1 楼 rui888 的回复:
参考这个。,
我问一下,每页的内容怎么传来的?
tony4geek 2016-02-01
  • 打赏
  • 举报
回复

81,094

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧