1

I have tried to update the input value of an exposed filter field before submit of the exposed filter through Js.

What I have tried

$('#edit-submit-phrases').on('click', function() {
  alert('check'); 
});

No alert message.

I also tried:

jQuery('#edit-submit-phrases').mousedown()

1 Answer 1

1

You can use the ajaxStart() function, to execute something before Ajax request begins:

 Drupal.behaviors.<themename/modulename> = {
  attach: function (context, settings) {
    $('#edit-submit-phrases').on('click', function() {
      $( document ).ajaxStart(function() {
        alert('check'); 
      });
    });
  }
};
8
  • Thanks for quick reply. Still getting the same issue. No alert message.
    – DRUPWAY
    Commented May 9, 2016 at 11:56
  • Are you using drupal.behaviours or just jquery ready?
    – Dev
    Commented May 9, 2016 at 11:59
  • i am using drupal.behaviours.
    – DRUPWAY
    Commented May 9, 2016 at 12:00
  • Works if i remove "$('#edit-submit-phrases').on('click', function() { $( document ).ajaxStart(function() { }); });
    – DRUPWAY
    Commented May 9, 2016 at 12:12
  • but you need it on that event only, right?
    – Dev
    Commented May 9, 2016 at 12:20

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.