<!DOCTYPE html>
<html>
<head>
<title>test</title>
<script src="./jquery.min.js"></script>
</head>
<body>
<button>点击</button>
<iframe src="http://www.baidu.com" style="height:300px;width:300px;"></iframe>
<script type="text/javascript">
$(function(){
$("button").click(function(event){
$("iframe").attr("src","http://www.szu.edu.cn").load(function(){
alert("更新了");
})
})
})
</script>
</body>
</html>
这段代码中为啥会出现alert的次数随着button点击的次数增多而增多的现象?
$(".list-item") There are two elements with class list-item, right?
The source code can be modified as follows:
This is caused by local repeated binding, but I still don’t understand the specific execution process of the code