Escaping for inline javascript.
<?php
use function Qubus\Security\Helpers\esc_js;
esc_js(string $string): string;
$string (string) (required) Javascript to be escaped.
(string) Escaped inline javascript after the esc_js
filter has been applied.
<?php
$esc_js = json_encode("Joshua's \"code\"");
$attribute = esc_js("alert($esc_js);");
echo '<input type="button" value="push" onclick="'.$attribute.'" />';
Last Updated on August 14, 2024 by Joshua