I figured this out, maybe it will help someone – probably, my script was loading on the header, so html was loading after script fired. What I did was adding those few parameters, where this last ‘true’ is the most important (moves script to footer). Hope this helps to anyone
wp_enqueue_script('js-file', plugin_dir_url(__FILE__).'/js/plugin_pj_script.js', '', '1.0.0', true);
Related Posts:
- How do I only load a plugin js on it’s settings pages?
- AJAX Call Via Vanilla JavaScript In WordPress Plugin Development
- Custom plugin giving: wp-admin/admin-ajax.php 400 (Bad Request)
- How to Reload the Dashboard After Clicking Update in Quick-Edit?
- Ajax call doesn’t work in frontend but it’s working in backend (when I’m logged in)
- Dequeue / Deregister script and replace it with a new plugin
- Insert code after tag without using functions.php?
- How do I use WordPress PHP functions in my Javascript code?
- Passing select control value to block
- How to create popup same as wordpress popup feature
- Has anyone used require.js for handling plugin scripts?
- Passing RichText attributes to function onChange
- How do I store information in a dynamic block in WordPress?
- How to load plugin after page is loaded – pagespeed issues
- Get IDs of Images from Gallery Block in InnerBlocks of a Custom Gutenberg Block
- React JSX in WordPress Plugin Development
- Pulling data from custom plugin settings using PHP shortcode and Javascript
- Best approach to fetch data from wp options to js file or php file
- Updating the Drag-To-Share eXtended share URLs?
- Enqueue WordPress plugin scripts below all other JS
- How to add Internationalization in WordPress using Javascript/React?
- wp.media javascript issue with on select
- How can I remove the WordPress-Version (?ver=5.x) from my plugin
- Redirect to another page using contact form 7? [closed]
- Delay JavaScript files from loading
- How to generate an all in one WordPress New content, plugin and theme update report on a website? [closed]
- How to use custom Javascript code inside a plugin?
- how to request a script more than once in wordpress
- Set Button in PluginDocumentSettingPanel Content (WordPress Gutenberg)
- Fixed: Console.log twice in the edit function
- Add style to body based on url
- How to properly enqueue jQuery knob on WordPress without conflict?
- Problem with wordpress has_action() function
- Multiple image selection custom widget
- Create a form and have custom menu display based on user answers?
- AJAX update fails for public/non-admin users
- WordPress ajax error 400 bad request for sending data to remote site [duplicate]
- How to use information from the database in the front-end?
- Custom plugin giving: wp-admin/admin-ajax.php 400 (Bad Request)
- How to pass value from WordPress to Javascript
- Javascript in plugin not working
- How to limit each front-end user to view just his own uploaded files on Amazon S3?
- Creating a user ‘add custom field’ section
- Need to hide an element depending on date and post category
- Ajax, jQuery and WordPress
- Plugin – including external javascript calling google maps
- get_option include in my adsense
- Is it possible to run javascript on plugin deactivated?
- Ajax in Plugins: returns the whole page
- Load css classes after using ajax calls
- How to create post comparison in wordpress
- How to access values from your own settings page in javascript?
- Vanilla javascript in custom gutenberg block not working
- TinyMCE – Unable to load the editor in vue front-end plugin page
- can not serialize and insert data from custom form
- Override comments.php template with plugin
- Current user in plugin returns NULL
- Do you clean up your self-written plugins’ at deactivation?
- Variable from a plugin into a theme
- What are the benefit in adding hook in the init() hook?
- Is it possible to set up multistore in Woocommerce? [closed]
- Why was my plugin rejected from the WordPress.org repository?
- Hidden Custom Post Type
- Upload file inside plugins options page
- Is there a way to programmatically enable a plugin?
- Sanitizing, Validating and Escaping in WordPress (Plugin)
- $wpdb working with ajax but showing ajax error instead of success
- How to make first_name and last_name required fields in user profile?
- Plugin not saving values when placed in a folder within /wp-content/plugins
- How to integrate plugin in WordPress theme
- Making my plugin translation ready. Poedit not working
- How to trigger an action with a URL
- How use %like% in sql statement wordpress
- Can I use a form in a dashboard widget?
- Let user subscribe to specific categories
- add_action in functions.php, do_action in plugin?
- Localiztion in javascript
- How can plugins have their own pages?
- Auto add content such as pages upon plugin activation?
- WP-Cufon adding extra space in my paragraphs in Firefox and Chrome
- Is there a way to alter the order in which the plugins appear in the page?
- Escape when echoed
- Scope for PHP Variables Assigned in functions.php or a plugin
- How to correctly detect accessing wp-content/uploads?
- Ajax gives 400 error
- adding a new value to a serialized array in WP_option table
- How to remove the woocommerce_checkout_process action hook in woocommerce if particular project in cart [closed]
- How to create custom embed block in gutenberg wordpress
- The Point of Using apply_filters()
- How do I turn a custom post type into a plugin?
- Plugin exceeds memory limit
- How can I implement a notification system in wordpress?
- Redirect to a welcome page after updating plugin
- Find the URL of the current plugin directory
- How to automate wordpress plugin activate and deactivate by php logic?
- Custom plugins/Manipulated plugins: Always a terrible idea to inherit these types of WP sites that discourage updates? [closed]
- Where does WordPress register default scripts like jQuery?
- Minimum PHP Required for WordPress
- Adding content before the loop in category pages
- How to get variables from fucntion.php to my plugin files