Get value in the forEach of JSP in JQuery to display in label

1

I would like help getting a value that is set within a forEach in my JSP, playing into Jquery and displaying it on a label on the same page.

This forEach retrieves a direct list from the database. I used hidden to retrieve the value I need, the: lista.deTipo . It turns out that this loop runs twice in the database, but when I get this value through id of hidden it only returns the first value of deTIpo . The rest of it does not pick up and I'm not sure how to loop through this loop on the JQuery side to get those two values for lista.deTipo .

Here is the code for jsp registrar.jsp :

<html:radio name="formulRadio" property="nuTipo" styleId="radioTipo" value="1"/>&nbsp;Tipo Interno&nbsp;&nbsp;&nbsp;&nbsp;
            <html:radio name="formulRadio" property="nuTipo" styleId="radioTipo" value="2"/>&nbsp;Tipo Externa&nbsp;&nbsp;&nbsp;&nbsp;
<c:forEach var="lista" items="${form.listaPo}" varStatus="listaMotivo" >
                    <input type="hidden" name="deTipo" id="deTipo" value="${lista.deTipo}">
                </c:forEach>

No js registra.js

$('#form input:radio').bind("click", function() {

    if ($(this).is(':checked')) {
        var tipo = $("input[@name='formulRadio']:checked").value;
        tipo = parseInt($(this).val());

        if(tipo == "2"){
            mensagemAlerta("Radio tipo externo acionado."+tipo,"INF");
                var deTipo = $("#deTipo").val();
                document.getElementById("descMotivo").innerHTML = deTipo;
    }
        else if(tipoTce =="1"){

            var deTipo = $("#deTipo").val();
            mensagemAlerta("Radio externa acionado."+deTipo,"INF");         
                document.getElementById("descMotivo").innerHTML = deTipo;   
        }
}});
    
asked by anonymous 10.08.2017 / 07:00

0 answers