jQuery: Run something after $.each has completed

You are here

JavaScript runs asynchronously, that means when you initialize $.each every bit of code that comes after that will not be executed when $.each has finished. Sometimes you need your code to be executed after each. I found out that the easiest way to do it is to use $.when and $.then.