I'm using wordpress, and contact form 7 plugin. What's i'm trying to accomplish is that some of the drop down menus are populated with custom javascript, I know that you can include it with another plugin "Scripts and Stuff" for example. but I wanted to put it in a seperate file and include the file in the body tags of the contact form with script src="http://example.org/myscript.js" (actual form created with the plugin)
EDIT: i donot want to add it to a footer.php of the theme, I want the script src to be on a Single page only. not the entire theme
sure, that's quite straight forward. There are 2 ways to achieve this,
<script>with your js code</script>
at the bottom of your form inside the cf7 form editor, this way the script loads only when the form is printed on the page. However, make sure you don't add any new lines spaces in your js code else cf7 plugin will insert empty<p></p>
elements and this will break your code at execution. Alternatively,if you are running WP4.7 you can now use the
do_shortcode_tag
which has been introduced with this release to actually enqueue your script on the same page as which the form is being printed, but remember to register that script earlier on first,