I happen to disable a div that has some form fields inside of it. I have other fields out of that div. When I submit the form, the fields inside the disabled div are sent empty to the database.How can I prevent all the fields inside the disabled div to submit since they are disabled. My purpose is to save the fields inside the disable div into a table if disabled is false. The fields out of the div will be saved in another table.
I had tried to put readonly, but this can't prevent them form from submit.
<form>
<div id="disable_texarea">
<textarea class="form-control" id="textarea1" disabled ></textarea>
<textarea class="form-control" id="textarea2" disabled></textarea>
<!--there are many inside the disabled div-->
</div>
<input type="text" id="input1">
<input type="text" id="input2">
<input type="text" id="input3">
</form>
js
$(document).ready(function() {
$("#disable_texarea *").prop('disabled', true);
});