I have a form which is saved to Local Storage as a String. My form however has few checkboxes, radio buttons and so on that use `attribute` instead of `value`. How can I perform such a check and pass on right "values" to the Local Storage in my dataSave function?

```
function dataSave(){
   var mngrFields = {};
   $(".mngr-field").each(function(){
      if ($(".mngr-field").is("checkbox")){
         mngrFields[this.id] = this.attr("checked");
      } else {
         // Default method to get input-text values
         mngrFields[this.id] = this.value;
      }
   });
   localStorage.setItem('fieldString', JSON.stringify(mngrFields));
}

```

The **default method to get input-text values** is working just fine on it's own, but when the checkbox checker is included, it breaks the whole application because of an error.

Any ideas on how can I build up a good checker that I might be able to use for radio buttons as well?