I'm just starting to playing around on a Mac for the first time and have created a very simple html page that uses jQuery to do a simple text swap when an h1 tag is clicked.
When I don't view the page through the webserver and just open it directly in Safari (file:///Applications/xampp/xamppfiles/htdocs/test/mypage.html) it works as expected. However, when I try to view through Apache (http://localhost/test/mypage.html) it doesn't work.
Here's the code (obviously I changed the tags to use brackets instead of less-than & greater-than.
[html]
[head]
[title]My Awesome Page[/title]
[script type="text/javascript" src="jquery.js"][/script]
[script type="text/javascript" charset="utf-8"]
function sayHello()
{ $('#foo').text('Hi there!');
}
[/script]
[/head]
[body]
[h1 id="foo" onclick="sayHello()"]Click me![/h1]
[/body]
[/html]
Am I missing something on the Mac? Wouldn't be an Apache setting since its client-side code.. right?
I should probably also mention that I loaded XAMPP to run Apache and MySQL. I have tested Apache to ensure its working using a simple PHP file.
Steve