Javascript:“不是函数”错误

时间:2017-09-30 14:56:10

标签: javascript jquery jsp

我想在我的代码中使用easyPaginate.js插件(https://st3ph.github.io/jquery.easyPaginate/):

的index.jsp

<script type="text/javascript" src="./js/jquery-3.2.1.min.js"></script>
<script type="text/javascript" src="./js/myJs.js"></script>
<script type="text/javascript" src="./js/jquery.easyPaginate.js"></script>
...
<div id="easyPaginate">
    <img src="img/demo/surf1.jpg" />
    <img src="img/demo/surf2.jpg" />
</div>

myJs.js:

$('#easyPaginate').easyPaginate({
    paginateElement: 'img',
    elementsPerPage: 3,
    effect: 'climb'
});

但是我收到以下错误:

  

未捕获的TypeError:$(...)。easyPaginate不是一个函数       at myJs.js:20

1 个答案:

答案 0 :(得分:2)

您应该按此顺序声明脚本:

    Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim i As Long


For i = 3 To 11
    Range("B" & i).Value = Range("c" & i)
Next i
    End Sub

如错误所示,<script type="text/javascript" src="./js/jquery-3.2.1.min.js"></script> <script type="text/javascript" src="./js/jquery.easyPaginate.js"></script> <script type="text/javascript" src="./js/myJs.js"></script> 脚本中找不到easyPaginate方法。