jQuery addClass example

Change class name on click in jQuery

by RichardAD

HTML

<div id="message">
</div>

JavaScript

var response = 
{
  "sys": {
    "type": "Array"
  },
  "total": 3,
  "skip": 0,
  "limit": 100,
  "items": [
    {
      "sys": {
        "space": {
          "sys": {
            "type": "Link",
            "linkType": "Space",
            "id": "SPACEID"
          }
        },
        "id": "ENTRYID1",
        "type": "Entry",
        "createdAt": "2019-05-22T15:03:51.318Z",
        "updatedAt": "2019-05-22T15:03:51.318Z",
        "environment": {
          "sys": {
            "id": "master",
            "type": "Link",
            "linkType": "Environment"
          }
        },
        "revision": 1,
        "contentType": {
          "sys": {
            "type": "Link",
            "linkType": "ContentType",
            "id": "contentTypeID"
          }
        },
        "locale": "en-US"
      },
      "fields": {
        "firstName": "John",
        "lastName": "Doe",
        "title": "John's Title",
        "building": "John's Building",
        "roomNumber": 1234,
        "picture": {
          "sys": {
            "type": "Link",
            "linkType": "Asset",
            "id": "ASSETID1"
          }
        }
      }
    },
    {
      "sys": {
        "space": {
          "sys": {
            "type": "Link",
            "linkType": "Space",
            "id": "SPACEID"
          }
        },
        "id": "ENTRYID2",
        "type": "Entry",
        "createdAt": "2019-05-22T15:03:51.318Z",
        "updatedAt": "2019-05-22T15:03:51.318Z",
        "environment": {
          "sys": {
            "id": "master",
            "type": "Link",
            "linkType": "Environment"
          }
        },
        "revision": 1,
        "contentType": {
          "sys": {
            "type": "Link",
            "linkType": "ContentType",
            "id": "contentTypeID"
          }
        },
        "locale": "en-US"
      },
      "fields": {
        "firstName": "Jane",
        "lastName": "Doe",
        "title": "Jane's title",
        "building":...