value of checkbox attr not changing as expected

value of checkbox attr not changing as expected

using this html

<p><input id="agree" type="checkbox" /> I agree: </p>

 and this jquery
  1. $(document).ready(function() {
  2.     $('#agree').change(function() {
  3.         alert($(this).attr('value'));
  4.     });
  5. });
When I run this I start with a unchecked checkbox as I should.  When I click the first time a check appears in the box ant the alert messate says on however the next time I click the check goes away but the alert box comes up with the on (shouldn't it be blank?)  every time I click the the alert tells me the value of $(this).attr('value') is on.
in the tutorial the value changes between '' and on on every click.
the tutorial:   http://thenewboston.org/watch.php?cat=32&number=58