• How can I check if jquery is included?
    I have this in plugin:

    function form_ajax_add_theme_codes() {
    
        wp_enqueue_script( 'example-ajax-script', plugins_url( 'js/simple-ajax-example.js', __FILE__ ), array('jquery'), null, true );
    }   
    add_action('wp_enqueue_scripts', 'form_ajax_add_theme_codes');
    
Viewing 5 replies - 1 through 5 (of 5 total)
  • I’m not 100% clear on the question.

    Unless jQuery is explicitly removed by some other code, it is part of core WordPress

    Thread Starter php-coder

    (@php-coder)

    From “View Page Source” of a page I do not see jquery there. Why?

    Moderator bcworkz

    (@bcworkz)

    Your code works on my site. The jQuery file is still loaded in the head section even if your script goes in the footer. Did you look there? Search the page source for “jquery.min.js” to confirm if it’s really there or not.

    Thread Starter php-coder

    (@php-coder)

    I have created another new page. There I can see jquery.js. Could not understand what was the problem with previous page.

    Moderator bcworkz

    (@bcworkz)

    Both pages using the same template? If a template does not somehow cause the “wp_head” action to fire, the needed scripts and other head section content will fail to appear. Normally that would completely break the page, but if the template generated most head content by other means, the page could still work while failing to load jQuery. That would be a very unusual situation. I’m skeptical this is what’s happening, but it would explain observed behavior.

    More likely is some sort of plugin/theme conflict, but then the problem ought to occur on other pages.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘How can I check if jquery is included?’ is closed to new replies.