老师,我的问题出在哪里?
来源:4-10 自由编程
sunflower426
2020-09-10 11:32:50
<!DOCTYPE <!DOCTYPE html>
<html class="no-js">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>自由编程</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="">
<style>
.red{
background:red;
}
</style>
</head>
<body>
<button>添加</button>
<ul>
<li>111</li>
<li>222</li>
<li>333</li>
<li>444</li>
</ul>
<script src="https://cdn.bootcss.com/zepto/1.1.7/zepto.min.js"></script>
<script>
$(function(){
var msg=444;
$("button").click(function(){
$("ul").append("<li></li>");
$("li:last-child").text(mag+=111);
});
$("ul").delegate("li","mouseover",function(){
$(this).addClass("red");
})
.delegate("li",mouseout,function(){
$(this).removeClass("red");
});
});
</script>
</body>
</html>
1回答
好帮手慕码
2020-09-10
同学你好,问题可参考下图:
如果我的回答帮到了你,欢迎采纳,祝学习愉快~
相似问题