November 20, 2015
jQuery 去除表单空值 serialize how to eliminate empty fields
1. Try adding this
$('input', '#submForm').each(function(){
$(this).val() == "" && $(this).remove();
})
OR
$('input:text[value=""]', '#submForm').remove();
before
var serialized = $('#submForm').serialize()
来源:http://stackoverflow.com/a/6240625
You cannot use attribute selector for value as it is a changing property.
2. Use .… Read More