Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

194
Vistas
How do you send a list of a node's children ids using thymeleaf?

I have a function that adds badges to a div by selecting items from a dropdown list.

I'm adding badges using this function added to the dropdown list onclick event:

function addBadge(parent, badgeId, value){
    var elem = document.getElementById(parent);

    var currentTaxiways = elem.children;
    var alreadyExists = false;

    for(var i = 0; i < currentTaxiways.length; i++){
        if(badgeId === currentTaxiways[i].id){
            alreadyExists = true;
        }
    }

    if(!alreadyExists) {
        var newBadge = document.createElement("span");
        newBadge.classList.add("badge");
        newBadge.classList.add("badge-primary");
        newBadge.classList.add("bg-secondary");

        newBadge.id = badgeId;

        var node = document.createTextNode(value);
        newBadge.appendChild(node);

        newBadge.innerHTML += "&emsp;";

        var deleteButton = document.createElement("a");
        deleteButton.href = "#";
        deleteButton.classList.add("x-btn");
        deleteButton.onclick = function delBadge() {
            deleteBadge(newBadge.id);
        };

        var node2 = document.createTextNode("X");
        deleteButton.appendChild(node2);

        newBadge.appendChild(deleteButton);

        elem.appendChild(newBadge);
    }
}

And the function for deleting the badges is this one:

function deleteBadge(badge){
    var elem = document.getElementById(badge);
    elem.parentNode.removeChild(elem);
}

How do I send the list of ids of all the badges added to the div to my controller using thymeleaf when the form is submitted?

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda