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

138
Vistas
Convert CheckBoxList to Multiselect Dropdown

I am currently trying to figure out how to edit the below script to convert a list from a check list to a multi select drop down list if it is possible. Any help that can be offered is appreciated.

function checkCheckBoxList(oSrc, args) {
  var isValid = false;
  $("#<%= cklLocations.ClientID %> input[type='checkbox']:checked").each(function (i, obj) {
    isValid = true;
  });
  args.IsValid = isValid;
}
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

You can map the checked checkboxes

const $dropdown = $("#dropdown");
const $checks = $("#cklLocations input[type='checkbox']").on("click", function() {
  $dropdown[0].length = 1; // remove all but first 
  const opts = $("#cklLocations input[type='checkbox']:checked").map(function() {
    return `<option value="${this.value}">${this.name}</option>`
  }).get().join("")
  $dropdown.append(opts)
})
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div id="cklLocations">
  <label>A<input type="checkbox" name="A" value="a" /></label>
  <label>B<input type="checkbox" name="B" value="b" /></label>
  <label>C<input type="checkbox" name="C" value="c" /></label>
  <label>D<input type="checkbox" name="D" value="d" /></label>
</div>
<select id="dropdown" multiple>
  <option disabled>Please select</option>
</select>

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