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

94
Vistas
Show multiple instances of div synchronous according to number of elements in select list

I have a select list that gets items from the datababase where we can add other items to it from an other list or delete items in it,

 <div class="form-group col-md-3">
 <label for="IX">Selected Issuing Banks</label>     
<select id="IX" name="IX" multiple="multiple" style="width: 250px; height: 70px; margin: 0px 2px 0px 3px;" data-bind="options: IX, optionsText: function(item) { return item.Name +' (' + item.BICCode + ')' }, optionsValue: 'Id',value: IdIX"></select>
</div>

And just after the selectlist, I have a div with multiple textfields to insert into the database, I want to show multiple numbers of this same div synchronously according to the items in the select, if the list essentially has 2 times we'll have this div shown twice, if we add another item to the list it will become 3 times and I am having trouble with making this

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

The trick will be in naming elements but jquery .each() should get you started:

$("#IX option").each(function () {
    $("body").append($("#fieldsDiv").html());
});

I'd recommend using a content template and dynamically build the new divs based on it:

<div class="divContainer">
</div>

<template id="fieldsDivTemplate">
    <div class="fields">
        <!-- your fields go here use {{tags}} as placeholders for id values -->
    </div>
</template>

<script>
    $(function () {
        let t = $("#fieldsDivTemplate").html();
        t = t.replace(/{{tags}}/g, "value from select list item goes here");

        body.append(t);
    });
</script>
about 4 years ago · Juan Pablo Isaza Denunciar
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