Number DIVs

This was meant to help me understand the 960 Grid System. I had first created four separate pages using PHP, each having a different number of divs. Then for whatever reason, I decided it was time to learn some javascript so I began working on this. The biggest problem I encountered was trying to remove the class names (grid_x, push_x, pull_x) when changing the divs. I could easily add a class using $('#grid1').addClass(new_class_name); with new_class_name being a var containing the new class, but I could only remove a class by using $('#grid1').removeClass('grid_x'); with grid_x being the actual class name. I just couldn't get it to work using a var.

Thanks to the awesome people at StackOverflow, I got it figured out. As it turns out this.match(/grid_[0-9]+/); returns an array of strings instead of the plain 'ol string I thought was being returned. So instead of using removeClass(old_class_name); it was suggested I try removeClass(old_class_name.join(' ')); and that did the trick! I love that site.