bootstrap 通过加减按钮实现输入框组功能
作者:云中不知人 时间:2024-04-16 09:26:06
实现效果图如下:
当我点击 + 按钮时,会添加一行输入框组;当点击 - 按钮时,会删除这一行输入框组
html代码如下:
<div class="input-group" id="centerIpGroup">
<label class="input-group-addon" id="basic-addon5">中心机IP:</label>
<button class="btn btn-info" type="button" data-toggle="tooltip" title="新增" id="addCenterIpGrpBtn" onclick="addCenterIpGrp(this)" disabled><span class="glyphicon glyphicon-plus"></span></button>
</div>
+ 按钮 点击触发事件函数:
//添加中心机IP输入框项
function addCenterIpGrp(obj){
html = '<div class="input-group centerIp">'+
'<label class="input-group-addon">IP:</label>'+
'<input type="text" class="form-control" id="ipInput">'+
'<label class="input-group-addon">注释:</label>'+
'<input type="text" class="form-control" id="descInput">'+
'<span class="input-group-btn">'+
'<button class="btn btn-info" type="button" data-toggle="tooltip" title="删除" id="delCenterIpGrp"><span class="glyphicon glyphicon-minus"></span></button>'+
'</span>'+
'</div>'
obj.insertAdjacentHTML('beforebegin',html)
}
- 按钮 点击触发事件函数:
$(document).on('click','#delCenterIpGrp',function(){
var el = this.parentNode.parentNode
var centerIp = $(this).parent().parent().find('#ipInput').val()
alertify.confirm('您确定要删除选中的命令?',
function(e){
if(e){ el.parentNode.removeChild(el)}})})
总结
以上所述是小编给大家介绍的bootstrap 加减删除输入框组网站的支持!
来源:http://blog.csdn.net/u011085172/article/details/78538338
标签:bootstrap,输入框
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
python解析多层json操作示例
2021-06-17 22:59:41
OpenCV中图像通道操作的深入讲解
2022-02-13 02:39:22
![](https://img.aspxhome.com/file/2023/0/121390_0s.jpg)
Go语言针对Map的11问你知道几个?
2024-05-05 09:33:19
SQLServer 设置单词首字母大写
2024-01-12 20:14:41
Python多个装饰器的调用顺序实例解析
2021-09-30 06:54:56
Python3 pandas 操作列表实例详解
2021-11-30 14:24:12
Windows系统下安装GIt及GIT基本认识和配置
2023-06-14 20:54:53
![](https://img.aspxhome.com/file/2023/0/67200_0s.png)
Opencv python 图片生成视频的方法示例
2021-11-08 22:18:38
![](https://img.aspxhome.com/file/2023/1/102791_0s.jpg)
通过ASP.net实现flash对数据库的访问
2024-01-14 17:04:30
![](https://img.aspxhome.com/file/2023/8/91398_0s.jpg)
asp fckeditor自定义上传文件的文件名
2011-03-30 11:03:00
numpy.insert用法及内插插0的方法
2023-03-28 10:06:13
![](https://img.aspxhome.com/file/2023/9/109499_0s.jpg)
oracle怎样修改表名、列名、字段类型、添加表列、删除表列
2010-07-23 11:10:00
Python爬虫中urllib库的进阶学习
2023-12-13 19:31:53
![](https://img.aspxhome.com/file/2023/1/72711_0s.png)
用python爬取租房网站信息的代码
2022-04-30 07:03:38
Go语言基础go接口用法示例详解
2024-04-30 10:06:53
![](https://img.aspxhome.com/file/2023/1/130691_0s.png)
用Python获取摄像头并实时控制人脸的实现示例
2022-12-11 09:50:21
能让Python提速超40倍的神器Cython详解
2023-11-12 07:11:11
![](https://img.aspxhome.com/file/2023/2/64662_0s.png)
python pygame实现2048游戏
2021-02-25 15:15:45
![](https://img.aspxhome.com/file/2023/5/93585_0s.jpg)
数据库清除日志文件(LDF文件过大)
2024-01-14 04:05:36
js点击事件的执行过程实例分析【冒泡与捕获】
2024-02-27 07:53:34