ClassList::replace

The replace() method replaces an existing class name with a new one in the element's class list.

Description

public ClassList::replace(string $previous, string $new): static

Parameters

previous

The class name to be replaced.

new

The new class name that will replace the previous class name.

Return Value

Returns the current instance (static), allowing for method chaining.

Exceptions

None

Source Code
If you find this project useful, consider leaving a on GitHub! Thank you!