Can't get addClass() to work out side of $(document.ready)
I want to be able to call a js function from any where in my site and cause a class change.
- ex. in some .js
- function hightlight_memorial_menu(){
- $("#the-fund-subnav #memorial_scholarship a").addClass('active');
- }
- js in some page:
- <script type="text/javascript" language="JavaScript">
- hightlight_memorial_menu();
- </script>
The problem is that when the function is called nothing happens... if my code is in the doc.ready function it works fine.
I don't think I'm doing anything wrong, but maybe someone can shed some light on why this isn't working for me.