My site is built with WordPress, and recently I’ve been adding some basic javascript to it: RossPW.com
However, all the javascript I’ve added doesn’t seem to work, and I can’t figure out why for the life of me!
For example, I added the following simple snippet to the header, to fade in the — but this doesn’t work:
<script type="text/javascript">
$('body').hide();
$('body').fadeIn(3000);
</script>
To try and troubleshoot this so far, I have tried two things:
1) Properly added wp_enqueue to the header.php (this has been known to cause some problems with wordpress in the past:
<?php wp_enqueue_script("jquery"); ?>
<?php wp_head(); ?>
2)I also tried included javascript as an external .js file here, with some basic JS to animate the header or scroll to the top — this hasn’t worked either.
Any help would be much appreciated — thanks!
UPDATE:
In order to ensure that js/jquery are loaded properly. I’ve tried this basic alert — which does in fact work!
<script type="text/javascript">
alert('ALERT!')
</script>
However, all the other javascript I’ve written does not — and I can’t figure out why. The javascript I’ve written seems to be fine, as seen here: jsfiddle.net/v9NSR/
Two Things to fix –
http://rosspw.com/wp-content/themes/rosspw2013/js/rosspw.js Line: 21,
Column: 5 Source Code: }); ;​
Let me know if it works for you or not.
Try to use
Firebugfor debugging.For better Understanding Check this screenshot –
As you are using jquery before its been loaded.