Function not working when added to wordpress?

Function not working when added to wordpress?

Hi

I'm new to Jquery and recently did my very first function.. Hurray!
It's a classic add current state to selected page. 
In my jsfiddle it work as it should, but when adding it to my Wordpress site, it stops working.
I've implemented the function in the header, but something is not working as it should.
It's the the li's in the ugly orange box that i'm trying to manipulate. 
What did i do wrong?

Cheers