admin管理员组

文章数量:1131440

I am working on creating a plugin. The first thing I do is enqueue my css and javascript files. If I view the page source, I am seeing both files loaded. The problem I am having, is I have some functions in the javascript file that won't load. I believe the issue is that the javascript file is loaded before the plugin content. This is probably really easy, but how do I force the javascript file to reload after my plugin content is loaded, or to be the last thing loaded?

I am working on creating a plugin. The first thing I do is enqueue my css and javascript files. If I view the page source, I am seeing both files loaded. The problem I am having, is I have some functions in the javascript file that won't load. I believe the issue is that the javascript file is loaded before the plugin content. This is probably really easy, but how do I force the javascript file to reload after my plugin content is loaded, or to be the last thing loaded?

Share Improve this question asked Oct 30, 2023 at 17:28 Darth Mikey DDarth Mikey D 931 silver badge9 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

Use a construct like this one:

(function( $ ) {
    'use strict';

    $( document ).ready( function() {
        // Put your code here
    });

})( jQuery );

本文标签: Javascript functions not running