Jquery Sorting
Thu Jul 06 2023 11:50:51 GMT+0000 (Coordinated Universal Time)
Saved by
@gshailesh27
$(function() {
var select = $('.selectedcity2');
select.html(select.find('option').sort(function(x, y) {
return $(x).text() > $(y).text() ? 1 : -1;
}));
$('.selectedcity2').prepend('<option disabled selected>Select city</option>');
});
content_copyCOPY
Comments