make the error alerts work on Bootstrap 3

And still works with Bootstrap 2.

Yes, I know this is an example from the book, but I’m actually using it.