1

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!

Carl Papworth
  • 1,282
  • 2
  • 16
  • 35

2 Answers2

1

As Jezen Thomas suggested, it may be an encoding issue. Try re-saving the file as UTF-8.

Check out this topic on SO for more details.

Community
  • 1
  • 1
DACrosby
  • 11,116
  • 3
  • 39
  • 51
1

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:

If you have an editor which shows the characters that make up the UTF-8 signature you may be able to delete them by hand. Chances are, however, that the BOM is there in the first place because you didn't see it.

Check whether your editor allows you to specify whether a UTF-8 signature is added or kept during a save. Such an editor provides a way of removing the signature by simply reading the file in then saving it out again. For example, if Dreamweaver detects a BOM the Save As dialogue box will have a check mark alongside the text "Include Unicode Signature (BOM)". Just uncheck the box and save.

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 to Text > Encoding and verify that UTF-8 is selected. If you can, show the invisible characters and remove anything that looks suspect.

Jezen Thomas
  • 13,619
  • 6
  • 53
  • 91