I got this jQuery code from here - Fiddle
$(document).ready(function () {
var $pagination = $('.qpagination');
var $lis = $pagination.find('li:not(#qprev, #qnext)');
$lis.filter(':gt(4)').hide();
$lis.filter(':lt(5)').addClass('active');
var $next = $('#qnext').click(function () {
var idx = $lis.index($lis.filter('.active:last')) || 0;
var $toHighlight = $lis.slice(idx + 1, idx + 6);
if ($toHighlight.length == 0) {
$prev.show();
return;
}
$next.show();
$lis.filter('.active').removeClass('active').hide();
$toHighlight.show().addClass('active')
});
var $prev = $('#qprev').click(function () {
var idx = $lis.index($lis.filter('.active:first')) || 0;
var start = idx < 4 ? 0 : idx - 4;
var $toHighlight = $lis.slice(start, start + 5);
if ($toHighlight.length == 0) {
$prev.hide();
return;
}
$next.show();
$lis.filter('.active').removeClass('active').hide();
$toHighlight.show().addClass('active')
});
}); // close jquery
However, when I copied the code and adjusted it according to my need it seems that it doesn't work. I get Uncaught SyntaxError: Unexpected token error.
What seems to be the issue? & how can I fix it?
Edit: These are the errors I get from Chrome:
Undefined variable: pagination
Undefined variable: lis
Undefined variable: next
Undefined variable: toHighlight
Edit#2: I got the code to work after loading jQuery 2.2.1 on fiddle but it doesn't work on
https://ajax.googleapis.com/ajax/libs/jquery/1.12.2/jquery.min.js?ver=4.4.2
in Wordpress, this version is used. http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js?ver=4.4.2
it doesn't work on that one neither, How could I get it to work on ver=4.4.2?
Here is my live website: http://gulf-brokers.com/