I have a simple form with four inputs. When I submit my form, I want to use the GET http method.
For the example :
aaa : foo
bbb : ____
ccc : bar
ffffd
With jQuery:
$('form[method="get"]').submit(function(){
$(this).find(':input').each(function() {
var inp = $(this);
if (!inp.val()) {
inp.remove();
}
});
});
I use this to remove all empty parameters from all GET forms on my site. The :input pseudo selector covers all inputs, textareas, selects and buttons.