getting index of li on click function for pagination