Skip to content

Instantly share code, notes, and snippets.

@vansosnin
Last active March 27, 2016 16:28
Show Gist options
  • Save vansosnin/5bbdf7808a4311989551 to your computer and use it in GitHub Desktop.
Save vansosnin/5bbdf7808a4311989551 to your computer and use it in GitHub Desktop.
Clear empty GET parameters
var $button = $('.js-filter-button');
$button.on('click', function(event) {
event.preventDefault();
var $this = $(this);
var $form = $this.closest('form');
var emptyTextBoxes = $form.find('input:text, input:radio, input:checkbox, select').filter(function() {
return this.value == "";
});
emptyTextBoxes.each(function() {
var $this = $(this);
if ($this.val() == '') {
$this.attr('disabled', true);
}
});
$form.submit();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment