<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<script type="text/javascript" src="jquery-3.1.1.js"></script>
<script>
$(document).ready(function(){
var a;
$("button").click(function(){
a = 2;
});
$("h1").html(a);
});
</script>
</head>
<body>
<h1>测试</h1>
<button>开始</button>
</div>
</body>
</html>
click事件不是触发了a=2这一赋值操作吗?可为什么a还是没有赋值?求大神指教ORZ