Skip to main content

escapeHTML

function escapeHTML(text: string): string;

Replaces a special character with an HTML entity.

  • & -> &
  • < -> &lt;
  • > -> &gt;
  • ' -> &#39;
  • " -> &quot;

Example

escapeHTML('Settings > Notification'); // 'Settings &gt; Notification'