Search code examples
jquerypaginatorlivesearch

Live search only works on first page of paginator


I have setup jQuery live search and it works well:

<script type="text/javascript">
    $(document).ready(function() {
        $("#peopleSearch").keyup(function() {
            if ($(this).val()) {
                var search = $(this).val().toLowerCase();
                $(".user").hide();
                $("[user*='"+search+"']").show();
            }
            else {
                $(".user").show();
            }
        });
    });
</script>

However, I have paginator and my search works only on the current page. How can I make it work on all pages?

<div class="paginator">
    {include file="ComEurolab/Views/paginator.tpl"}
</div>

Solution

  • Use ajax in your search results container so your JS variables keep their state.