jQuery can't be found with this code if you simply paste it in Notepad, save it and open the file in a browser.
You must either :
- serve your file using an HTTP server (i.e. not access it using
file://
)
- or change the URL of jQuery to not use a protocol relative URL (an URL starting with
//
)
The simplest fix would be to change
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js">
to
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js">
but the serious one will be to always test using a local HTTP server (it's very easy to install Apache on any OS including Windows). There are many things you can't test with file://
, including most cross domain ajax operations.