ajax_example.js 849 B

1234567891011121314151617181920212223242526272829
  1. /*
  2. * @file
  3. * JavaScript for ajax_example.
  4. *
  5. * See @link ajax_example_dependent_dropdown_degrades @endlink for
  6. * details on what this file does. It is not used in any other example.
  7. */
  8. (function($) {
  9. // Re-enable form elements that are disabled for non-ajax situations.
  10. Drupal.behaviors.enableFormItemsForAjaxForms = {
  11. attach: function() {
  12. // If ajax is enabled.
  13. if (Drupal.ajax) {
  14. $('.enabled-for-ajax').removeAttr('disabled');
  15. }
  16. // Below is only for the demo case of showing with js turned off.
  17. // It overrides the behavior of the CSS that would normally turn off
  18. // the 'ok' button when JS is enabled. Here, for demonstration purposes,
  19. // we have AJAX disabled but JS turned on, so use this to simulate.
  20. if (!Drupal.ajax) {
  21. $('html.js .next-button').show();
  22. }
  23. }
  24. };
  25. })(jQuery);