<!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">
<script src="js/jquery.js"></script>
<title>Document</title>
<style>
.wrapper {
margin: 50px auto;
width: 800px;
border: 1px solid black;
padding: 30px;
}
#content {
margin: 10px;
width: 600px;
height: 200px;
border-style: none;
border: 1px solid black;
}
label,
button {
vertical-align: bottom;
}
ul li {
display: none;
width: 600px;
height: 30px;
list-style: none;
margin-left: 50px;
border-bottom: 1px dotted black;
text-align: left;
}
a {
float: right;
}
</style>
</head>
<body>
<div class="wrapper">
<label for="content">微博发布</label>
<input type="textarea" id="content">
<button>发布</button>
<ul>
</ul>
</div>
<script>
$(function () {
$('button').on('click', function () {
var li = $('<li></li>');
li.html($('#content').val() + '<a href="javascript:;">删除</a>');
$('ul').prepend(li);
li.slideDown();
$('#content').val('');
})
$('ul').on('click', 'a', function () {
$(this).parent().slideUp(function () {
$(this).remove();
});
});
})
</script>
</body>
</html>