当第一个div达到一定限制时,如何删除它?
谁能指导我删除第一个 div,当有 5 个 div 时,
我正在克隆一个文本框,用户可以添加多个文本框 但是当它达到 5 时,我应该自动删除第一个文本框并在节点末尾添加另一个文本框
谢谢
Can anyone guide me to delete the first div, when there are 5 div's
I'm cloning a text box, users can add multiple textbox's
but when it reaches to 5, i should automatically delete the first textbox and add another at the end of the node
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用 jQuery:
您需要计算所有这些 div 并删除第一个:
要添加新的 div:
With jQuery:
You need to count all of these divs and remove first one:
To add new div: