You don’t seem to have a trigger for your JS. You can test that the script is actually running by adding a quick console, such as
console.log('xyz.js is running');
Once you’re sure your JS is running, you can add a trigger. If you’re already loading jQuery, it has an easy .ready()
function to use, but if not, there are other ways.
It’s also best practice to enqueue your JavaScript, instead of adding <script>
tags directly. See wp_enqueue_script(). You may want to do this before adding your console and before adding the trigger, as really enqueueing is the first step.