I am trying to call a JS function in a Wordpress function in a plugin file. The JS file is successfully enqueued and reading the page source I can see the function is there waiting to be called. However I am getting an error:
Uncaught ReferenceError: jsFunction is not defined
The plugin function executes on a gravity form submission and this has worked before but not for calling the JS function. This is the WP function:
function call_js_function() {
?>
<script type="text/javascript">
jsFunction();
</script>
<?php
}
add_action( 'gform_after_submission_7', 'call_js_function' );
jsFunction:
function jsFunction() {
console.log('hello world');
}
Aucun commentaire:
Enregistrer un commentaire