当前位置:网站首页>微博发布案例
微博发布案例
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
边栏推荐
- 普通测试年薪15w,测试开发年薪30w+,二者差距在哪?
- 考研失败,卷不进大厂,感觉没戏了
- 抽丝剥茧C语言(高阶)数据的储存+练习
- PostgreSQL source code (59) analysis of transaction ID allocation and overflow judgment methods
- Make a bat file for cleaning system garbage
- Kuboard can't send email and nail alarm problem is solved
- 1、 Go knowledge check and remedy + practical course notes youth training camp notes
- Hidden Markov model (HMM) learning notes
- 1140_ SiCp learning notes_ Use Newton's method to solve the square root
- Mobx knowledge point collection case (quick start)
猜你喜欢

transform-origin属性详解

1090: integer power (multi instance test)

Introduction to abnova's in vitro mRNA transcription workflow and capping method

計算機服務中缺失MySQL服務

Communication between non parent and child components

外包干了三年,废了...

Make a bat file for cleaning system garbage

Redis data migration

MIPS uclibc cross compile ffmpeg, support g711a encoding and decoding

Initial experience of teambiion network disk (Alibaba cloud network disk)
随机推荐
[semantic segmentation] - multi-scale attention
Invalid table alias or column reference`xxx`
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
Talk about seven ways to realize asynchronous programming
【性能压测】如何做好性能压测?
JS small exercise ---- time sharing reminder and greeting, form password display hidden effect, text box focus event, closing advertisement
Interviewer: what development models do you know?
Freeswitch dials extension number source code tracking
毕设-基于SSM大学生兼职平台系统
Advanced practice of C language (high level) pointer
按键精灵脚本学习-关于天猫抢红包
Procedure in PostgreSQL supports transaction syntax (instance & Analysis)
Leetcode-226. Invert Binary Tree
Leetcode-206. Reverse Linked List
Non empty verification of collection in SQL
KBU1510-ASEMI电源专用15A整流桥KBU1510
我理想的软件测试人员发展状态
二、并发、测试笔记 青训营笔记
MIPS uclibc cross compile ffmpeg, support g711a encoding and decoding
Hidden Markov model (HMM) learning notes