当前位置:网站首页>微博发布案例
微博发布案例
2022-07-07 04:00:00 【九阈】
①点击发布按钮,动态创建一个小li ,放入文本框的内容和删除按钮,并且添加到ul中。
②点击的删除按钮,可以删除当前的微博留言。
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
*{
margin: 0;
padding: 0;
}
ul{
list-style: none;
}
.box {
position: relative;
width: 450px;
height: 450px;
margin: 20px auto;
background-color: skyblue;
}
button {
position: absolute;
right: 10px;
top: 50px;
width: 80px;
height: 80px;
border: 0;
font-size: 20px;
}
textarea {
outline: none;
}
li {
padding: 5px 0;
}
</style>
<script src="jquery.min.js"></script>
</head>
<body>
<div class="box" id="weibo">
<textarea name="" class="txt" id="" cols="40" rows="10"></textarea>
<button class="btn">发布</button>
<div>留言区:</div>
<ul></ul>
</div>
<script>
$(function(){
//1.点击发布按钮,动态创建一个小li,放入文本框的内容和删除按钮,并且添加到ul中
$(".btn").on("click",function(){
var li = $("<li></li>");
li.html($(".txt").val()+ "<a href='javascript:;'>删除</a>");
$("ul").prepend(li);
li.slideDown();
$(".txt").val("");
})
//2.点击的删除按钮,可以删除当前的微博留言li
$("ul").on("click","a",function(){
$(this).parent().slideUp(function(){
$(this).remove();
});
})
})
</script>
</body>
</html>
部分代码转载于
https://blog.csdn.net/weixin_58131487/article/details/120946647
边栏推荐
- Pass parent component to child component: props
- PostgreSQL source code (60) transaction system summary
- Composition API premise
- Select the product attribute pop-up box to pop up the animation effect from the bottom
- Docker compose start redis cluster
- Wechat applet full stack development practice Chapter 3 Introduction and use of APIs commonly used in wechat applet development -- 3.10 tabbar component (I) how to open and use the default tabbar comp
- [cloud native] how to give full play to memory advantage of memory database
- Several important steps to light up the display
- 科技云报道:从Robot到Cobot,人机共融正在开创一个时代
- Bi she - college student part-time platform system based on SSM
猜你喜欢

KBU1510-ASEMI电源专用15A整流桥KBU1510

計算機服務中缺失MySQL服務

07_ Handout on the essence and practical skills of text measurement and geometric transformation

Kuboard can't send email and nail alarm problem is solved

Role of virtual machine

Detailed explanation of neo4j installation process

Nesting and splitting of components

How can a 35 year old programmer build a technological moat?

1、 Go knowledge check and remedy + practical course notes youth training camp notes
![[2022 CISCN]初赛 web题目复现](/img/1c/4297379fccde28f76ebe04d085c5a4.png)
[2022 CISCN]初赛 web题目复现
随机推荐
Hidden Markov model (HMM) learning notes
普通测试年薪15w,测试开发年薪30w+,二者差距在哪?
Readonly read only
Flutter riverpod is comprehensively and deeply analyzed. Why is it officially recommended?
Fullgc problem analysis and solution summary
Music | cat and mouse -- classic not only plot
考研失败,卷不进大厂,感觉没戏了
Calculus key and difficult points record part integral + trigonometric function integral
JS small exercise ---- time sharing reminder and greeting, form password display hidden effect, text box focus event, closing advertisement
按键精灵采集学习-矿药采集及跑图
JS small exercise
The currently released SKU (sales specification) information contains words that are suspected to have nothing to do with baby
Initial experience of teambiion network disk (Alibaba cloud network disk)
Sqlmap tutorial (IV) practical skills three: bypass the firewall
软件验收测试
Interviewer: what development models do you know?
科技云报道:从Robot到Cobot,人机共融正在开创一个时代
聊聊异步编程的 7 种实现方式
Kuboard无法发送邮件和钉钉告警问题解决
English translation is too difficult? I wrote two translation scripts with crawler in a rage