具体如图:具体代码如下:<!DOCTYPE html><html> <head> <meta charset="UTF-8"> <title></title> <style ></style> </head> <body> <ul > <li>1:<input type="text" /><button type="button" class="add">增加</button><button type="button" class="del">删除</button></li> <li>2:<input type="text" /><button type="button" class="add">增加</button><button type="button" class="del">删除</button></li> </ul> <script type="text/javascript" src="https://cdn.bootcss.com/jquery/3.3.1/jquery.js" ></script> <script> $(function(){ $('.add').click(function(){ console.log('dian'); $(this).parent('li').append('<li><input type="text" /><button type="button" class="add">增加</button><button type="button" class="del">删除</button></li>') }) $('.del').click(function(){ $(this).parent('li').remove(); }) }) </script> </body></html>
添加回答
举报
0/150
提交
取消