I have found some code here on Stack Overflow to add my own script to the functions.php file. But it’s not working for me. Is there something wrong with this code?

function add_my_script() {
        wp_enqueue_script(
            get_template_directory_uri() . '/js/about_us_cont_function.js', // this is the location of your script file
            array('jquery') // this array lists the scripts upon which your script depends
        );
    }
add_action( 'wp_enqueue_scripts', 'add_my_script' );

jQuery:

jQuery('.absolute_img_links').click(function(){
    alert("Hello! I am an alert box!!");
});

Read more here: Adding jQuery script to WordPress


Solution:

If you know the solution of this issue, please leave us a reply in Comment section, to update the question.


Wordpress related questions and answers: