So I tried to solve my problem (question) based on this topic:
Sort element by numerical value of data attribute
(Thank you for that!)
In my particular case I have to retrieve a numeric part of each class to do the same task.
I created this fiddle:
https://jsfiddle.net/z9fugfrq/
I need a numeric order.
The script that I tried to modify for my purposes:
jQuery(document).ready(function(){
var $wrapper = $('.choose-course-3-wrapper');
$wrapper.find('.item-course').sort(function(a, b) {
var aclassStr = a.attr('class'),
asortNum = classStr.substr( classStr.lastIndexOf('-') + 1);
var bclassStr = a.attr('class'),
bsortNum = classStr.substr( classStr.lastIndexOf('-') + 1);
return +asortNum - +bsortNum;
})
.appendTo($wrapper);
} );
throws arrows and I do not understand why. Thanks for help in advance!
Garavani