3
I have a form and within this form I am adding a certain input
dynamically via jquery
using a button, these inputs go to a array
in a controller C#.
Currently I’m doing so:
for (var j = 0; j < numeroDePiscinas; j++) {
formdata.append("Piscinas", $("#piscina"+j).val());
}
The problem is that this logic will no longer work because the user will be able
can remove these inputs, I used the Id
of the agreed input that was added , ex posição 1
, id=piscina1
What I want to do is get all the inputs with the class inputPiscina
and send its value to the controller, I tried something like this :
$("#form:formPiscina").each(".inputPiscina",
function() {
formdata.append("Piscinas", $(this).val());
});
but it didn’t work, If anyone can help me, if anyone knows any better way to do it, I’d appreciate it.
Cool, I’ll try this way too, a quick question what the
.map
I’m very lay in that part.– William Cézar