Create a JS ascending/descending sort function -- 2

Job ID: 32128501

Budget: $10 – $30 USD

Hello..

I want a JS function to sort by ascending and descending order of elements on my page..

The currectly div that i want to apply this function is:
https://pastebin.com/yhu3P6t0

This container have seasons boxs with episodes inside of it.

I want to sort like this:

For ascending:
Season 1
Episode 1
Episode 2
Episode 3
Episode 4
--
Season 2
Episode 1
Episode 2
Episode 3
Episode 4.. etc..

For descending:
Season 2
Episode 4
Episode 3
Episode 2
Episode 1

Season 1
Episode 4
Episode 3
Episode 2
Episode 1 ..etc
Related categories: PHP JavaScript HTML jQuery / Prototype jQuery