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
- Redesigning Custom Post Type “Add New” page
- Is there any record of installed plugins in the database?
- Custom headers for the WordPress plugin directory
- plugin wants to update to wrong plugin
- How can I add a custom header to a custom template in a plugin without using the theme folders
- Trying to avoid including wp-load.php
- Custom values are not translated
- Make the plugin directory recognize new version numbers
- How to include admin-ajax when loading external javascript
- How to make first_name and last_name required fields in user profile?
- Avoiding Duplicate function names in Post Loop (WP_Footer script)
- Can we use a webservice with WordPress?
- WooCommerce get_price returning wrong price when used via ajax
- Using custom JS plugins with WordPress?
- New User Form – Custom Menu Page
- Checking instances of scripts in wp_head
- How can I prevent my plugin go development trunk [closed]
- Best way to maintain and update 3rd-party WP plugin when developer is unresponsive?
- Are functions in main plugin file called before function bound to register_activation_hook runs?
- Best place for if/else piece of code related to custom plugin?
- how to do login using woocommerce rest api From android
- How to create a code editor for my plugin .?
- Manually set a custom admin sub-menu selected?
- How to test ‘upgrader_process_complete’ hook in plugin development?
- How to make custom plugin run on demand?
- WooCommerce – set session with new cart item meta when updating cart item quantity [closed]
- Using WordPress to build membership Page
- Set WordPress Transient Expiration via Variable Value
- Override plugin class which has namespace
- Plugin create pages and use templates
- Quick press publish post hook
- I cannot include a file in my plugin settings page
- force logged in user to stay in the dashboard
- Show popup on click
- How to change “Read More” text?
- Shortcode and WP query using category attributes
- Securing a plugin pop-up window
- Woocommerce – Change variations output
- Is admin section completely customizable in terms of styling?
- Better way to run heavy scripts using WordPress database
- wp_enqueue_scrpts seems not to get called
- WordPress ajax not working in registration
- TypeErrors with Yoast, jQuery in conflict?
- Jquery post responses 500 error after some time and lastly an 503 error
- is_user_logged_in() undefined at shutdown in plugin context
- What are Seeds? [closed]
- Shortcode cannot parse attributes within double quotes. ” is becoming ” breaking my shortcode