I am very new to jQuery. I am trying to create a simple page. Using google's hosted jQuery. Based on many examples from stackoverflow, I have written this small piece of code. The change event never gets fired. I also do not see 'can not load' alert. If I look in the firebug and expand the script tag from google it shows it as 'undefined'. I am testing locally, not using any web-server. Can anyone please point out my mistakes? Code as below:
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link href="./styles/qForm.css" rel="stylesheet" type="text/css"/>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js"></script>
<script>
if (!window.jQuery) {
alert("can not load');
}
$('#choice').change(function () {
alert('here!');
if($(this).val() == '0') $(this).addClass('empty');
else $(this).removeClass('empty')
});
$('#choice').change();
</script>
</head>
<body>
<div id="surround">
<div id="top">
<h3 id="title"> Enter Information </h3>
</div>
<div id="bottom">
<select id="choice">
<option style="color: gray;" value="0" selected="selected">Select...</option>
<option value="1">one</option>
<option value="2">two</option>
<option value="3">three</option>
</select>
</div>
</div>
</body>