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
- dbDelta only creates the last table
- Sync my svn repositories
- Getting a custom Gutenberg component’s state from outside that component
- Override plugin localization
- When do I need to use esc_attr when using WordPress internal functions
- Where should my plugin POST to?
- WordPress widget / plugin….fields not appearing in my widget
- Create Proper WordPress Ajax Request in JavaScript, NOT jQuery
- What is $tab in `install_plugins_{$tab}` hook?
- Get all options saved by another plugin
- How to get the permalink of a page when loading my plugin
- Ajax gives 400 error
- WordPress Plugin Page is Loading in Admin Content Container Instead of Separate Page
- Serialize data for wp options
- Is Wrapping intval() Around esc_attr() Redundant for Escaping Input?
- Plugin Options Not Saving to Database in WP 4.5
- Executing Javascript when a New Post is Published
- Insert Array in Plugin Database
- coding a WordPress AJAX Form using PHP to check if User is Logged Out and Show error
- plugin wraps the entire content
- Shortcode Attributes to Return different $_POST
- How programatically cause uploads folder to be created?
- How to enqueue some javascript source once per page
- Using Class loader in WordPress boilerplate
- Javascript fetch on wordpress plugins not working
- Allow a particular user to access a particular plugin?
- wordpress plugin add page when activate
- The Build menu theme is frozen with the wordpress theme
- How to prevent redoing get_posts queries and make results available to other scripts?
- Prefix WordPress Taxonomy Tags With Hashtag Symbol Like Twitter
- Speeding up WordPress on a Local Network
- Embed Javascript code to registered users only
- WP internationalization not loaded
- How to set up php,javascript and css to allow for our finished product to be displayed within a page?
- Adding custom cron_schedule prior to wp_schedule_event
- Create plugin with form in post and submit it to specific form
- Storing values in Post Meta vs new tables
- Get page type to display content
- Widget redirecting to home page
- Capturing POST data
- I am using multi image metabox plugin but I did get how to display the images in templete?
- How to open author url linked to a new tab in settings page in the WordPress plugin list
- How can I properly sanitize the update_option in WordPress?
- Why is my menu page not being displayed?
- WordPress 6.3 with datatables – cannot seem to pass json from php to javascript
- Mixed results with is_page() WordPress function, when using $this, or self
- I have created a custom plugin. After activation it creating page but i am not getting how to add another php file at page content?