Add custom javascript file from local and internet?
-
Hi
How would one add a javascript that refers to fields from a form?
I have added Javascript file that contains hardcoded ID of a field to enable a small function.
In addition to this file I would also like to add a script from a website.I have looked into the scripts() function under visual-form-builder.php
So to do the above would I add the following lines to that scripts() function?wp_register_script( 'my-JSfile', plugins_url('/js/my-JSfile.js', __FILE__ ); wp_enqueue_script( 'my-JSfile' ); wp_register_script( 'externalJS', plugins_url('http://maps.google.com/maps/api/js?sensor=false&libraries=places&language=en-AU', __FILE__ ); wp_enqueue_script( 'externalJS' );Would this work? How would one normally use custom JS to affect a form? Seems easy to apply custom styling to the form with CSS. But not sure about adding custom Javascript.
Thanks 🙂
The topic ‘Add custom javascript file from local and internet?’ is closed to new replies.