JS Event Does not Trigger From File

Hi Experts,

If you go to http://aces-project.com/2017/_NEW.php and click on the hamburger menu right of the email, you will see that nothing happens. Whereas you wll see that in js/header.js, line 78 I have a trigger.

Even more stranger when I copy the following into chrome console and click on the hamburger, it does triiger the alert.
$('#divMobileBars').on('click', function(){

Open in new window

Any help will be appreciated.
APD TorontoSoftware DeveloperAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

RobOwner (Aidellio)Commented:
it's because the dom hasn't completely loaded yet.. as you're including your header.js in the <head> section.

wrap your javascript in the jQuery init function


$(function() {
$('#divMobileBars').on('click', function(){

or alternatively put the header.js at the end of the file, just before the </body> tag.  I personally prefer the former (the init function)

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
APD TorontoSoftware DeveloperAuthor Commented:
Thank you so much, I forgot about it!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.