So I’m doodling with a little site with some html/css/javascript experiments so I can learn to be a better web-programmer. I am really a designer, and total n00b at this.
Problem:
I have some javaScript running on multiple pages at my site, and they are – as per usual – in a seperate .js-file. However it only seems to be working on this page:
http://www.carlpapworth.com/htmlove/colors.html
And not on these:
http://www.carlpapworth.com/htmlove/arrows.html
http://www.carlpapworth.com/htmlove/fumbling.html
U see, the big splash with the heart is suposed to be hidden by this function:
$(document).ready(function() {
$('#reward').hide();
$('#goal a').click(function(){
$('#reward').fadeIn(1000);
});
$('.exit').click(function(){
$('#collection1').css('color', '#ff63ff');
});
});
To me, the “Head”-code in all these pages looks exactly the same, so I can’t figure out the problem.
Please help!
SOLVED! It was the encoding, that was set to UTF-16! So I just changed it as Jezen Thomas said in Coda! Thanks a million!
This was an interesting question. I tried copying your site to my machine and testing locally, and everything worked just fine. However, I believe I’ve discovered the source of the problem.
http://validator.w3.org/i18n-checker/check?uri=www.carlpapworth.com%2Fhtmlove%2Ffumbling.html#validate-by-uri+
You’re trying to force UTF-8 with your meta tag,
<meta charset='UTF-8' />. However, the w3 i18n validator detected that your file also contains a UTF-16LE Byte-Order Mark (BOM).The w3 has this to say on removing the BOM:
I’m not sure if it’ll fix the problem in your case, but I don’t like the fact that you’ve used HTML comments before your doctype declaration. Please move
<!DOCTYPE html>to the top of the file. Also, in Coda, go toText > Encodingand verify that UTF-8 is selected. If you can, show the invisible characters and remove anything that looks suspect.