---
title: "removeElement(for:)"
framework: paperkit
role: symbol
role_heading: Instance Method
path: "paperkit/markuporderedset/removeelement(for:)-5khjd"
---

# removeElement(for:)

Removes the associated element for the given id from the set.

## Declaration

```swift
@discardableResult mutating func removeElement(for id: MarkupOrderedSet.ElementID) -> MarkupOrderedSet.Element?
```

## Parameters

- `id`: The id of the element to remove.

## Return Value

Return Value The associated element for id if the set contains id; otherwise, nil.

## See Also

### Removing elements

- [remove(_:)](paperkit/markuporderedset/remove(_:).md)
- [remove(at:)](paperkit/markuporderedset/remove(at:).md)
- [removeAll(where:)](paperkit/markuporderedset/removeall(where:).md)
- [removeElement(for:)](paperkit/markuporderedset/removeelement(for:)-4pqof.md)
- [removeStroke(for:)](paperkit/markuporderedset/removestroke(for:).md)
