I am trying to write a code to solve certain items after the user clicks enter. Sometimes, this can take a while, so I am making the div look like a spinner so that the user knows that it is working.
To accomplish this, I am adding a class to the DOM object being solved which makes it look like a spinner. My problem is that solve algorithm is completed before the class is added. I have tried a number of different ways to resolve the issue and all have failed. This includes various implementations of the deferred object and the promise method.
Is there any way to ensure that DOM manipulation is complete before moving on in your code?