The sort() method sorts the elements of an array in place and returns the reference to the same array, now sorted.
The jQuery array sort() function is used to sorts the elements of the array. This function is a built-in function in jQuery. This function sorts the array of a number, string, and object in ascending and descending order.
When the sort() function compares two values, it sends the values to the compare function, and sorts the values according to the returned (negative, zero, positive) value. If the result is negative a is sorted before b . If the result is positive b is sorted before a .
I've been looking at a lot of examples where people use the .sort()
function in jQuery.
So for example:
$('#myId').sort(..);
By I cannot find any documentation for sort()
in the jQuery API, can anyone show me its usage?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With