In my form I got both visible and non-visible (display:none) elements. I need to get form data for only visible fields. I am collecting the data with the following code:
var formData = $('#myForm')
.serializeArray()
.reduce(function(obj, item) {
//need to process only visible fields somewhere here
obj[item.name] = item.value;
return obj;
}, {});
I know about disabling the name propery of the input, but after the data is collected, I would like to return this property for all fields back. Any ideas would be welcome. Thank you.
$('#myForm :visible')