Created
September 9, 2023 09:41
-
-
Save aimahdi/54fbd19658c2a13f58a017371f04e4b3 to your computer and use it in GitHub Desktop.
Use custom JS on conversational forms
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_action('fluentform/conversational_frame_footer', function() { | |
printf("<script type='text/javascript' id='%s-js-extra'>\n", esc_attr($handle)); | |
$data = " | |
let name = document.querySelector(\"[name=\'input_text\']\"); | |
name.value = \"Ibrahim Mahdi\"; | |
console.log(name.value)"; | |
echo "$data\n"; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- $data is hardcoded localized data and escaped before being passed in. | |
echo "</script>\n"; | |
}, 10, 0); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment