I am trying to sort the list of elements using the javascript/jquery.
But for the first time the sorting is happening which is fine, but if I click again then it should go to the unsorted view.
and the process should go on like this…
Here is the demo link:
I think the below code is what you are searching for (sort in ascending order on first click and reverse on next click.):