What would be the way best to convert form elements to an JavaScript Element?
I would like some automatic way to build JavaScript objects, without having to loop each element. I do not want any strings returned like in var formData = f.serialize();
.
My HTML
<script type="text/javascript">
$(function() {
$("#sendrfr").click(function() {
var f = $("#Commtnx");
var formData = f.serialize();
alert(formData);
});
});
</script>
<div id="outter">
<form id="Commtnx" action="/Home/Test1" method="post" name="down">
<div id="inner">
<input id="input1" type="text" value="2" />
</div>
</form>
</div>
<input type="submit" id="sendrfr" />
<>
snippet editor – mplungjan Oct 12 at 7:42var data = $('#formID input');
This will give you array of elemets, Similarly you can addselect
,textarea
too into the selector. – Reddy Oct 12 at 7:42