Add class with jquery to ajax form

help me please with my form.
I have ajax form here https://dev.atdevside.com/jobs/
At left sidebar item work such as filter on click, how i can add class to element after click.

            jQuery(document).ready(function ($) {
                var container = $(".noo-main > .jobs");
                if (container.length) {
                    $("#filter_form").change( function (event) {
                        event.preventDefault();
                        var $form = $("#filter_form .form-control");
                        var data = $(this).serialize();
                        history.pushState(null, null, "?" + $form.serialize());
                        $.ajax({
                                url: "<?php echo admin_url('admin-ajax.php'); ?>",
                                data: data
                            })
                            .done(function (data) {
                                if (data !== "-1") {
                                    $(".noo-main").html(data);
                                    if ($('[data-paginate="loadmore"]').find(".loadmore-action").length) {
                                        $('[data-paginate="loadmore"]').each(function () {
                                            var $this = $(this);
                                            $this.nooLoadmore({
                                                navSelector: $this.find("div.pagination"),
                                                nextSelector: $this.find("div.pagination a.next"),
                                                itemSelector: "article.loadmore-item",
                                                finishedMsg: "<?php echo __('All jobs displayed', 'noo'); ?>"
                                            });
                                        });
                                    }
                                } else {
                                    location.reload();
                                }
                            })
                            .fail(function () {

                            })
                    });
                }
                $("#filter_form").submit(function () {
                    $(this).find("input[name='action']").remove();
                    $(this).find("input[name='_wp_http_referer']").remove();
                    $(this).find("input[name='live-search-nonce']").remove();

                    return true;
                });
            });

Read more here: Add class with jquery to ajax form

Leave a Reply

Your email address will not be published. Required fields are marked *