Question: I've done a lot of searching on the web and found examples that treat `$('#checkbox').attr('checked')` as a string and others that treat it as a Boolean.

In my case, I find that this statement works as expected:

```
$('#AcceptAgreement').attr('checked', false);

```

But this one does not:

```
if ($('#AcceptAgreement').attr('checked') == true)

```

The second statement is false because in fact the value is 'checked'.

So which is it? Is it a string or Boolean value, and how can I read and write it in a reliable manner?

Answer: 
This depends on which version of jQuery you are using.

`checked` is both a property and an attribute. In older versions of jQuery, `.attr()` always returned the property, not the attribute, which was usually a boolean value. Newer versions of jquery (1.6+) have a new method called `.prop` which returns the boolean property value, while `.attr()` now properly returns the string value. I'm not sure if the attribute is always updated when the property changes.
To write you must use: 

```
$('#AcceptAgreement').attr('checked', 'checked');

```

If you wanna know if it is checked can use:

```
if($('#AcceptAgreement').attr('checked'))

```