0
我相当卡住了。试图学习和练习一些基本的JQuery并且失败。 onchange事件不起作用。任何想法为什么这看似简单的事情不会触发?当我查看chrome开发工具时,Jquery参考就在那里。感谢帮助。JQuery Onchange事件不起作用
<html>
<head>
<script type="text/javascript" src="jquery-1.7.2.js"></script>
<script type='javascript'>
$(document).ready(function(){
$("#groups").change(function(){
alert("hi");
});
});
</script>
</head>
<body>
<form id="select_form">
Select Group to Review:<br />
<select id="groups" class ="groups">
<option value="0">Select Group</option><option value="1">GoTeam</option> </select>
<br /><br />
<input type="submit" value="confirm" />
</form>
<div id="result"></div>
</body>
</html>
工作对我来说:http://jsfiddle.net/EeZLB/ - 你得到任何错误? – Hamish 2012-04-16 12:46:14
也许你保存的'jquery-1.7.2.js'在html文件以外的文件夹中。 – fragmentedreality 2012-04-16 12:48:59
@Hamish - 你没有按照OP的代码嘲笑它。他们在HTML中拥有JS。看到它在这里失败。 http://jsfiddle.net/uajDB/1/ – 2012-04-16 12:51:23