## Toggle(*string*) {#toggle}

Removes the token from the list if it exists, or adds the token to the list if it doesn't.

```csharp
public bool Toggle(string token)
```

| Parameter | Type | Description |
| --- | --- | --- |
| token | String | The token you want to toggle. |

### Return Value

A Boolean indicating whether token is in the list after the call.

### See Also

* class [DOMTokenList](../)
* namespace [Aspose.Html.Collections](../../../aspose.html.collections/)
* assembly [Aspose.HTML](../../../)

---

## Toggle(*string, bool*) {#toggle_1}

Removes the token from the list if it exists, or adds the token to the list if it doesn't.

```csharp
public bool Toggle(string token, bool force)
```

| Parameter | Type | Description |
| --- | --- | --- |
| token | String | The token you want to toggle. |
| force | Boolean | A Boolean that, if included, turns the toggle into a one way-only operation. If set to false, then token will only be removed, but not added. If set to true, then token will only be added, but not removed. |

### Return Value

A Boolean indicating whether token is in the list after the call.

### See Also

* class [DOMTokenList](../)
* namespace [Aspose.Html.Collections](../../../aspose.html.collections/)
* assembly [Aspose.HTML](../../../)
