I'm following js snippet to grab value dynamic number of input elements. I then use that values as a property inside js object which I later sent to mvc controller.
Since I already using Model inside razor which already has necessary properties to send to the mvc controller I wonder how can I grab those dynamic input elements values without using javascript object.
var myArr= [];
for (var i = 1; true; i++) {
var pTxtBox = $('#PCaption' + i);
var nTxtBox = $('#PWinners' + i);
if ((pTxtBox).length) {
var myObj = {};
myObj.Name = pTxtBox.val();
myObj.NWinners = nTxtBox.val();
myArr.push(myObj);
} else {
break;
}
}