Escapes html special characters in the specified string.
Parameters:
Name | Type | Description |
---|---|---|
unsafe | string | The string to be escaped. |
- Since
- 1.0.0
- Source
Returns:
Returns a string with all html special characters escaped.
- Type:
- string
Example
import { escapeHtml } from "@gravityforms/utils";
function Example() {
const str = 'my <strong>bold</strong> text will be escaped'
const escapedString = escapeHtml( str );
}