JSFiddle - React, Tailwind, and code Playground
HTML
<pre>
<form id=myform>
<input type=text name=inp1 value=aaa>
<input type=text name=inp2 value=bbb disabled>
<input type=text name=inp3 value=ccc readonly>
<input type=text name=inp4 value=ddd disabled readonly>
<input type=checkbox name=inp5 value=eee disabled checked>
<input type=checkbox name=inp6 value=fff readonly checked>
</form>
<button id=mybutton>try serialize</button>
JavaScript
$("#mybutton").click(function(){
var data = [];
// standart serializing method that ignores diabled inputs:
data = $("#myform").serialize();
// test alert collected data
alert(data);
//once again:
var data = [];
// here, we will find all inputs (including textareas, selects etc)
// to find just diabled, add ":disabled" to find()
$("#myform").find(':input').each(function(){
var name = $(this).attr('name');
var val = $(this).val();
//is name defined?
if(typeof name !== typeof undefined && name !== false && typeof val !== typeof undefined)
{
//checkboxes needs to be checked:
if( !$(this).is("input[type=checkbox]") || $(this).prop('checked'))
data += (data==""?"":"&")+encodeURIComponent(name)+"="+encodeURIComponent(val);
}
});
// test alert collected data
alert(data);
});