Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

137
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!