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

166
Views
array select option jquery validation [ without plugin ]

in the result query return set of select option like this

 while($row=$result->fetch_array()) {
    
    <select name="level[]" id="level[]">
      <option value=''>please select level</option>
      <option value='level 1'>Level one</option>
      <option value='level 2'>Level two</option>
      <option value='level 3'>Level three</option>
      <option value='level 4'>Level four</option>
    </select> 
    
    }
 <br><br>
    <input type="button" id="btn_level" value="choose level">
    

and jquery validation like this

$(document).ready(function() {

  $('#btn_level').click(function() {

    var level = $('#level[]').val();

    if (level == '') {
      alert('please select level');
    }

  });

});

above validation not work if use with array , but work for single select option, how to use jquery with array result ?

jsfiddle code playground

about 4 years ago · Juan Pablo Isaza
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!