Skip to content

Instantly share code, notes, and snippets.

@aimahdi
Created September 9, 2023 09:41
Show Gist options
  • Save aimahdi/54fbd19658c2a13f58a017371f04e4b3 to your computer and use it in GitHub Desktop.
Save aimahdi/54fbd19658c2a13f58a017371f04e4b3 to your computer and use it in GitHub Desktop.
Use custom JS on conversational forms
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