I have forms with hidden and visible inputs as shown below. In this example, I want to serialize only name = "country", which is not hidden
<form id="finalform">
<input type='hidden' name='sid' value='901271316' />
<input type='hidden' name='tco_currency' value='USD'>
<input name='country' value='India' />
</form>
I tried the code below, but it even serializes hidden inputs.
var frm = $("form#finalform:visible");
var add= JSON.stringify(frm.serializeArray());
source
share