`classList` API is still quite new and browser support is not that good yet.

I'd suggest using the jQuery `hasClass()` method here instead, so you could just do:

```
if (button_obj.hasClass('foo') {

}
```