## NetworksChange event Triggered when there is a change to the available networks the provided card can run on. If the list of available networks is still loading, an event with `networks: null` and `loading: true` is triggered. When the list of available networks loads, Stripe triggers an additional event that contains the list of these networks and shows `loading: false`. Refer to our [card brand choice guide](/card-brand-choice.md#identifying-the-available-card-networks) for further details. **Syntax:** `element.on(...)` #### cardElement - `event` ('networkschange') **required** The name of the event. In this case, `networkschange`. - `handler` (function) **required** `handler(event) => void` is a **callback function** that you provide that will be called when the event is fired. When called it will be passed an event object with the following properties: - `loading` (boolean) `true` if the networks are loading. `false` when Stripe returns all the available networks. - `networks` (stringArray | null) All available networks for the card number provided. `null` if the networks are still loading. If eligible for the Card Element's [Card Brand Choice](/card-brand-choice.md) dropdown, this array will be truncated to a single network so that the user is not presented with multiple network selections. ### Handle a card networkschange event ```js cardElement.on('networkschange', function(event) { if (event.networks && event.networks.length >= 1) { // collect card brand preference } }); ``` ```es_next cardElement.on('networkschange', (event) => { if (event.networks && event.networks.length >= 1) { // collect card brand preference } }); ``` #### cardNumberElement - `event` ('networkschange') **required** The name of the event. In this case, `networkschange`. - `handler` (function) **required** `handler(event) => void` is a **callback function** that you provide that will be called when the event is fired. When called it will be passed an event object with the following properties: - `loading` (boolean) `true` if the networks are loading. `false` when Stripe returns all the available networks. - `networks` (stringArray | null) All available networks for the card number provided. `null` if the networks are still loading. If eligible for the Card Element's [Card Brand Choice](/card-brand-choice.md) dropdown, this array will be truncated to a single network so that the user is not presented with multiple network selections. ### Handle a cardNumber networkschange event ```js cardNumberElement.on('networkschange', function(event) { if (event.networks && event.networks.length >= 1) { // collect card brand preference } }); ``` ```es_next cardNumberElement.on('networkschange', (event) => { if (event.networks && event.networks.length >= 1) { // collect card brand preference } }); ```