Hi,
You were almost there, but there are a couple of little things you have to change.
First off, you have this in line 24:
HTML Code:
<script type="javascript">
change it to:
HTML Code:
<script type="text/javascript">
Then you need to move the entire JavaScript block to the end of the document, just before the closing </body> tag.
As it is you are calling your script before jQuery has loaded and thus are getting an error.
The third thing you need to change is this:
Code JavaScript:
$(document).ready(function() {
into this:
Code JavaScript:
jQuery(document).ready(function ($) {
The reason for this is that the jQuery library included with WordPress loads in "no conflict" mode. This is to prevent compatibility problems with other JavaScript libraries that WordPress can load.
In "no-confict" mode, the $ shortcut is not available and the longer jQuery is used. By including the $ in parenthesis after the function call you can then use this shortcut within the code block.
You can read more about this here: http://stackoverflow.com/questions/1...is-not-a-funct
Your code will then look like this:
HTML Code:
...
</div><!-- end of container div -->
</div><!-- end of wrapper div -->
<script type='text/javascript' src='http://jaybeeweb.com/Markham_Gym/wp-content/plugins/ultimate-tables/js/jquery.dataTables.js?ver=1.0'></script>
<!-- Don't forget analytics -->
<script type="text/javascript">
jQuery(document).ready(function ($) {
$('#schedule_9week span').each(function(){
$(this).parent().css('background-color', $(this).css('background-color'));
});
});
</script>
</body>
</html>
And everything will be good.
Hope that helps
Bookmarks