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

163
Views
Sort child divs alphanumerically

I want to sort some child divs under a parent div. The child divs has alphanumeric id. For example: "1_tango" , "5_charlie", "unassigned".

For the above example, the sort result should be:

"unassigned" , "1_tango" , "5_charlie",

The code I am using from here:

var mylist = $(this.sub_group_drop_zone);
var listitems = mylist.children('div').get();
listitems.sort(function (a, b) {
    var compA = $(a).text().toUpperCase();
    var compB = $(b).text().toUpperCase();
    return (compA > compB) ? -1 : (compB > compA) ? 1 : 0;
   })
$(mylist).append(listitems);

However this results in :

"unassigned", "5_charlie", "1_tango", "3_Beta" ..

How can I fix that. Any idea would be appreciated.

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!