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: 
Probably you should not use attributes, to change state just use 'checked' property of the dom node

```
$('#AcceptAgreement')[0].checked = false
if ($('#AcceptAgreement')[0].checked)

```
There is a fundamental way of finding out the data types

```
console.log(typeof $('#AcceptAgreement').attr('checked'));

```

But before jQuery 1.7, it used to return property value, now it returns pure string.

Another alternative to this is `.prop('checked')` which return boolean.