Aeroplankton Enthusiasts Society

Intangible Products for an Ephemeral World

jQuery: Remove empty GET variables from URL

This little JQuery snippit can tidy up those GET method form posts by disabling empty inputs on Submit:

<script>
  (function($) {
    $('form').submit(function() { // ## Clean GET Variables
      $('form input').each(function() {
        if ($(this).val().length == 0) { // ## If Empty
          $(this).attr('disabled', true); // ## Disable Input
        }
      });
    });
  })(jQuery);
</script>
© 2024 Aeroplankton Enthusiasts Society, All rights reserved.