> ## Documentation Index
> Fetch the complete documentation index at: https://docs.confidolegal.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Change Events

To provide a great UI/UX experience on your page you will want to know when changes happen within the fields. You can add any number of change listeners to the SDK that will be called when the internal state of the fields change.

```javascript theme={"system"}
const myListener = (e: ChangeEvent) => {
  console.log(e);
};

window.confidoHostedFields.addChangeListener(myListener);

// then later, clean it up
window.confidoHostedFields.removeChangeListener(myListener);
```

## Event Types

| Type                  | Description                                                                                                                                                                                                  |
| --------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `bin_change`          | Emitted when the first 9 digits of the card number field changes                                                                                                                                             |
| `bin_loaded`          | After the bin number changes, the SDK makes a network call to get more information about the current card, including the card type (debit or credit). This event is emitted after this network call returns. |
| `field_error_cleared` | Emitted when a field, that was previously in error, is fixed.                                                                                                                                                |
| `fields_loaded`       | Emitted when all the fields of the active form type are finished loading.                                                                                                                                    |
| `initializing`        | Emitted immediately following a call to `sdk.init()`                                                                                                                                                         |
| `initialized`         | Emitted once initialization is done and successful.                                                                                                                                                          |
| `init_error`          | Emitted when there's an error with initialization.                                                                                                                                                           |

## ChangeEvent Fields

<ParamField body="type" type="string" required>
  The type of event. This can be one of the types listed above.
</ParamField>

<ParamField body="state" type="object" required>
  The current state of the fields. See the [State
  Object](/hosted-fields-js/state-object) for more details.
</ParamField>
