Handle `checkbox`different than other `input` elements (such as text, password ...), by using a different selector and check, if the `checkbox` is checked.
This commit is contained in:
Sebastian 2023-02-13 20:22:01 +01:00 committed by GitHub
parent 532140d967
commit fb0f974580
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -14,12 +14,21 @@
className: className
};
$('input').each(function() {
$('input:not([type=checkbox])').each(function() {
var key = $(this).attr('name');
var value = $(this).val();
args[key] = value;
});
$('input[type=checkbox]').each(function() {
var key = $(this).attr('name');
var value = $(this).val();
if($(this).is(":checked")) {
args[key] = value;
}
});
$('select').each(function() {
var key = $(this).attr('name');
var value = $(this).val();