Escapes html special characters in the specified string.

Parameters:
NameTypeDescription
unsafestring

The string to be escaped.

Since
  • 1.0.0
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 );
}