So I created a view listing all the users. I implement a search form with autosubmit function.

The autosubmit works with an ajax script.

Into my page view, I changed a few things in Jquery like this (main.js) :

    //code for others pages.....


But when I filter my list of users, the ajax script is loading and after that, Jquery changes do not appear due to ajax load.

Do you know a trick to keep Jquery changes when ajax script is loading ?

Thanks for your help !

2 Answers 2


Try this:

Add an ajaxComplete function

   $( document ).ajaxComplete(function() {
  • I edit my post btw, It does not work Jan 7, 2016 at 15:15
  • @CorentinBranquet I assumed you were just focusing on the snipped rather than the entire code. Since I thought you got the document ready function to work.
    – No Sssweat
    Jan 8, 2016 at 1:21
  • It works for me. Oct 29, 2018 at 20:45

Find the solution below:

(function($) {
  Drupal.behaviors.events = {
    attach: function(context, settings) {
      $('#views-exposed-form-recherche-artiste-page', context).ajaxSuccess(function(){
  • Tried your solution but it still not working for me. Should i change something else apart from my view ID? i'm using Views Load More, and my code doesn't work after getting more news in my view
    – xstean
    Jan 28, 2016 at 14:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.