JSFiddle - React, Tailwind, and code Playground
HTML
<form id="form">
<input type="text" disabled="disabled" value="1" />
<input type="text" value="2" />
<input type="text" disabled="disabled" value="3" />
<input type="text" value="4" />
<button type="button" id="process">Process</button>
</form>
CSS
input, button {
display: block;
}
JavaScript
function processInputs(form) {
var fields = $(form + " :input").not("button");
fields.each(function (index, element) {
var isDisabled = $(element).is(':disabled');
if (isDisabled) {
$(element).prop('disabled', false);
} else {
// Handle input is not disabled
}
});
}
$("#process").click(function () {
processInputs($(this).closest('form').attr('id'));
});