Ad

Page Auto Refreshes After Selecting An Options

- 1 answer

New to coding, just a quick question. I have this code, this is a sidebar filter option. Now what i want to happen is after selecting an option the page refreshes. What code should i add? Thanks in advance

<style>
  .mobile_sidebar {
    background-color: white;
}
</style>

<div class="mobile_sidebar">
    {% if template contains 'collection' %}
        {% include 'collection_sidebar' %}
    {% endif %}

</div>
Ad

Answer

You'll probably need to add some javascript to the page. The JQuery library might be able to help you in this respect (although there are many ways to do this).

Try this:

<script>
    $(".mobile_sidebar").on("click", function () { window.location.reload(); }
</script>

NOTE: I didn't test this.

Ad
source: stackoverflow.com
Ad