<html>
<head>
<title></title>
<link rel="stylesheet" type="text/css" href="http://apps.bdimg.com/libs/bootstrap/2.3.2/css/bootstrap.min.css">
<script type="text/javascript" src="http://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js"></script>
<script type="text/javascript" src="http://apps.bdimg.com/libs/bootstrap/2.3.2/js/bootstrap.min.js"></script>
</head>
<body>
<button class="btn btn-large" type="button">Large button</button>
<ol id="ssss">
</ol>
<script type="text/javascript">
$("button[type='button']").click(function(){
$("#ssss").append('<li><a href="#">123</a><i class="icon-remove"></i></li>');
});
</script>
</body>
</html>
点击按钮一次添加一个`
123那么如何点击一下,就可以删除此条的
里的内容?版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。
<html>
<head>
<title></title>
<link rel="stylesheet" type="text/css" href="http://apps.bdimg.com/libs/bootstrap/2.3.2/css/bootstrap.min.css">
<script type="text/javascript" src="http://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js"></script>
<script type="text/javascript" src="http://apps.bdimg.com/libs/bootstrap/2.3.2/js/bootstrap.min.js"></script>
</head>
<body>
<button class="btn btn-large" type="button">Large button</button>
<ol id="ssss">
</ol>
<script type="text/javascript">
$("button[type='button']").click(function(){
$("#ssss").append('<li><a href="#">123</a><i class="icon-remove"></i></li>');
});
$('#ssss').on('click', 'i.icon-remove', function(e){
$(this.parentNode).remove();
});
</script>
</body>
</html>