I'm afraid my title is somewhat messy. I am working with Spring MVC and my form is associated to a class with several ArrayList and when trying to get javascript(jquery is fine) to recover the value of one o its attributes it always returns "undefined" of [Object object] instead of the value.
My jsp
<c:forEach var="item" items="${form.fact}" varStatus="status">
<tr>
<td>
<sf:hidden path="fact[${status.index}].name"/>
<c:out value="${form.fact[status.index].name}" />
</td>
<sf:hidden path="fact[${status.index}].id"/>
</tr>
</c:forEach>
The value I'm trying to recover for my js is the one that is hidden, that is, the "id".
when using:
var nm= $("fact2.id").val();
I get undefined although when checking the code of the page I see:
<input id="fact2.id" name="fact[2].id" type="hidden" value="55572"/>
I have tried with
document.getElementById("fact2.id")
document.getElementsByName("fact[2].id")
but can't manage to get the value.
If anybody can help I would greatly appreciate it. Thank you.