<head>
????<meta?http-equiv="Content-type"?content="text/html;?charset=utf-8"?/>
????<title></title>
????<script?src="http://lib.sinaapp.com/js/jquery/1.9.1/jquery-1.9.1.min.js"></script>
????
</head>
<body>
????<input?type="text"?value="慕課網(wǎng)"?/>
????????
????<button?id="bt1">觸發(fā)input元素的select事件</button>
?
<script?type="text/javascript">
????$("input").select(function(e){
????????alert(e.target.value)
????})
????$("#bt1").click(function(){
????????$("input").select();
????})
????</script>
</body>
</html>代碼來自jQuery基礎(chǔ)--事件篇 的 3-3 select事件的簡化,很多人回答是由于冒泡導(dǎo)致,但是我不能理解怎么冒泡的,請幫忙詳細解釋一下。
為什么點擊按鈕觸發(fā)select事件會執(zhí)行三次alert?
Cassie_yu
2016-07-12 18:09:32