Would you please try below code to your plugin page.
if the script file is your plugin root directory.
function plugin_adding_scripts() {
wp_register_script('my_test_script', plugins_url('testscript.js', __FILE__), array('jquery'),'1.1', true);
wp_enqueue_script('my_test_script');
}
add_action( 'wp_enqueue_scripts', 'plugin_adding_scripts' );
Also: http://blog.aztora.com/add-css-js-into-wordpress-plugin/
Related Posts:
- Is it ever okay to include inline CSS in plugins?
- How to include jQuery and JavaScript files correctly?
- Load js/css files only on specific admin UI pages
- Get list of scripts / styles and show file which enqueued them
- jQuery in header or footer
- How to prevent loading of all plugin’s resources?
- How to combine multiple CSS files and concatenate JavaScripts if WordPress recommends enqueuing them?
- Use js script from one plugin in another plugin
- Can’t get JS code to work with shortcode
- How do I add a javascript file to all admin pages via a plugin?
- Dequeue theme stylesheets but keep widget styling on custom page template
- Relative path instead of absolute for wp_enqueue_script
- is_page() function doesnt working
- how to include javascript file and css file in wordpress
- How to avoid loading same script twice?
- How to run a external JavaScript file on wp-admin if admin, and other if normal user?
- Where to call wp_enqueue_script in a plugin with custom template?
- How to insert html/css/javascript code to wordpress plugin
- CSS not affecting widget output
- How can I avoid conflicts between plugin and theme?
- should i be checking for jquery before enqueing it in a plugin
- My stylesheets are not enqueuing
- Plugin Development – Class Constructor Not Firing wp_enqueue_style action hook
- Enqueuing scripts and styles in custom plugins
- How to enqueue scripts in right way in a plugin?
- How to make my shortcode load scripts and styles, from within the plugin?
- enqueing Javascript and CSS
- Theme JS is available but theme CSS isn’t
- Enqueue a file that’s not js or css
- How to insert HTML/CSS/JS into my iframe plugin?
- Enqueue ONLY Plugin Styles and Scripts
- CSS not being applied using wp_enqueue_style
- WordPress Plugin Authoring question about jquery and css
- Is “document loaded” different on admin side than public side?
- plugin css is not being applied to the page
- How do I ensure I can loop through every enqueued script and CSS?
- Append php file to footer
- How to avoid conflict if a plugin already have included open library?
- Add a Script button in W3 Total Cache plugin not working due to conflicting jQuery version
- Bootstrap 4 Optimization
- How to only Load scripts on variable products page
- how to add contact form 7 shortcode in javascript variable
- wp_enqueue_script() with unknown path and maybe symlink
- Deregistering a script in WordPress seems impossible
- Why is my javascript not invoked in my hooks except wp_head?
- Enqueue scripts in footer
- Loading scripts with wp_register_script and wp_enqueue_script
- Adding Dropbox dropin js using wp_enqueue_script
- Replacing Scripts in Admin Load_Scripts
- Is there a way to ensure plugin script loads before another script?
- React JSX in WordPress Plugin Development
- Gutenberg blocks not getting styled on back end
- Is there no admin ui guide for 4.x?
- Is there an event or an other method that tells me the preview is loaded?
- Plugin CSS not enqueing
- What is the proper way to include Bootstrap when executing a shortcode
- Enqueueing a script and a style sheet not working
- WordPress Plugin with a shortcode that dynamically generates javascript. Can I use add_action without wrapping the javascript in a function?
- conditionally load javascript & CSS for do_action() calls from plugin
- Correct check for any admin page with editor
- What stylesheets are available in core?
- Making a plugin only available on the front-end for the logged in super admin
- Enqueue WordPress plugin scripts below all other JS
- How to prevent UNDO on guternberg block editor
- How to enqueue style in WordPress plugin from theme files?
- Do I have to worry about useState causing a re-render?
- Creating a custom Gutenberg block with columns
- How to integrate my HTML and javascript into my child theme
- “import declarations may only appear at top level of a module” when importing WooCommerce API node module
- wp.template() returns tags in Ajax response
- Gutenberg: import dependency or assign from global variable?
- How to enqueue or include json file to a plugin
- My WordPress plugin cannot load my JavaScript file
- javascript datatables in a plugin
- How to load library scripts in admin from plugins in noConflict wrapper?
- How to remove default style of header in wordpress metabox
- add javascript files only when plugin is called?
- jQuery does not enqueue for my purpose… (before an inline script in the footer)
- Inserting code to HTML view from a pop up initiated from visual view
- Plugin – Make sure jquery is loaded in my settings page plus my JS file
- How can I remove the WordPress-Version (?ver=5.x) from my plugin
- Enqueue script globally
- How to control an elements classes from multiple Gutenberg sidebar controls?
- Redirect to another page using contact form 7? [closed]
- How should I go about registering JavaScript that isn’t a file? [duplicate]
- Plugin Development/ Stop CSS clashes.
- What action hook can I use to add a JavaScript to a page post using a theme template that is not including get_header() nor get_footer()?
- Child theme stylesheet not always overriding “index”
- Can’t change the style of a submit input type? [closed]
- Make a plugin page out of influence of the theme’s style
- WP Plugin Running before jQuery
- wp_localize_script is not adding a global variable for javascript
- Is the wp_enqueue method efficient?
- Loading Modernizr (or other JavaScript libraries) for use in a plugin
- Enqueuing a script before anything else
- WordPress plugin enqueue scripts working for js, but not css files
- How to import the css in the plugin admin area?
- Loading custom js file on the admin page through plugin
- Distributing Frontend Assets with Plugins
- Run JavaScript validation script on form submit in plugin