wdpr
    Preparing search index...
    • Escape a value for safe embedding inside a JavaScript string literal that itself appears within an HTML attribute (e.g. onclick="fn('...')" ).

      Uses hex escapes (\xNN) and unicode escapes (\uNNNN) for characters that could break either the JavaScript string or the enclosing HTML attribute context: backslash, quotes, angle brackets, ampersand, newlines, and the Unicode line/paragraph separators (U+2028/U+2029).

      Parameters

      • value: string

        The raw string to escape.

      Returns string

      The escaped string safe for use inside a JS string literal in HTML.