Skip to content Skip to sidebar Skip to footer

Wordpress External Script Not Working

I am using this function in order to load jQuery and my custom script: function.php if (!is_admin()) add_action('wp_enqueue_scripts', 'my_jquery_enqueue', 11); function my_jquery_e

Solution 1:

Firstly, you shouldn't be deregistering jQuery, or loading it, you should just add is a dependency for your script, and Wordpress will take care of the rest

if (!is_admin()) {
    add_action("wp_enqueue_scripts", "my_jquery_enqueue", 11);
}

functionmy_jquery_enqueue() {
    wp_register_script( 'FormScript', get_stylesheet_directory_uri() . '/FormScript.js', array('jquery'));
    wp_enqueue_script( 'FormScript' );
}

secondly, jQuery runs in noConflict mode in Wordpress

jQuery(document).ready(function($) {

    $("#Main").hide();
    $("#Angehoerigkeit").hide();
    $("#Alter").hide();
    $("#Image").hide();

});

Post a Comment for "Wordpress External Script Not Working"