I would definitely go online. The benefit to it, other than the "luxury" of doing it from your own home (or bed!), you could do it in phases. The whole nature of it allows you to log in and log off as you please. If you need a break, you can pause and come back to it later. It didn't need to happen all in one sitting. (Except when you are at the part to take a quiz/test, then obviously you need to finish it before 'pausing') I found this extremely helpful as I was home with a newborn.
In the beginning I had went to the classes, and found it to be a complete waste of time. Boring, long and a total drag. While I don't know the prices of those classes anymore, I'm pretty sure that online classes are cheaper. I've done the actual physical classes twice and then later the online classes also twice now (I know, I must be a horrible driver!) There isn't any online class I'd specifically recommend... I know that they (DMV) give you a list of traffic schools, and I just picked one from there.