1

I am trying to use the easyPaginate.js plugin (https://st3ph.github.io/jquery.easyPaginate/) in my code:

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'
});

but I am getting the following error:

Uncaught TypeError: $(...).easyPaginate is not a function at myJs.js:20

1 Answer 1

2

You should declare scripts in this order:

<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>

As the error says, easyPaginate method can't be found in myJs script.

Sign up to request clarification or add additional context in comments.

1 Comment

It is also recommended to put the scripts at the bottom of the page, so you don't "block" the browser.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.