bootstrap layer.open中end的使用

遇到一个问题:点击layer弹出层中的按钮之后,完成一系列操作,弹出层自我关闭并在父界面弹出一句提示。

简单查找了一下,发现了layer.open中的end。

下面三句介绍引自 http://fly.layui.com/jie/185/

end - 层销毁后触发的回调
类型:Function,默认:null
无论是确认还是取消,只要层被销毁了,end都会执行,不携带任何参数。
这样,写出了自己的需求

layer.open({
					type:2, //弹出层现实的样式
					//shade:false,  //不显示背景阴影,去掉这个属性则显示
					//skin:"layui-layer-rim",  //加上边框
					closeBtn:0,    //不显示关闭按钮
					//shadeClose:true,//开启遮罩关闭        就是点击其他地方,弹框消失
					title:"发现新问题",//title:false 不显示标题
					area: ['800px', '300px'], //弹出层宽高
					content:"question.php?qid=1",   //捕获的元素

					end: function(){
						window.parent.layer.msg('发布成功');
					}
				});


  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Bootstrap does not have a built-in feature for editing rows in a table. However, you can achieve this functionality using JavaScript or a JavaScript library like jQuery. Here's a basic example of how you can implement an edit feature for table rows using Bootstrap and jQuery: 1. Include the necessary libraries in your HTML file: ```html <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.0/umd/popper.min.js"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script> ``` 2. Create a table with editable rows: ```html <table class="table"> <thead> <tr> <th>Column 1</th> <th>Column 2</th> <th>Edit</th> </tr> </thead> <tbody> <tr> <td contenteditable="true">Row 1, Column 1</td> <td contenteditable="true">Row 1, Column 2</td> <td><button class="btn btn-primary edit-btn">Edit</button></td> </tr> <tr> <td contenteditable="true">Row 2, Column 1</td> <td contenteditable="true">Row 2, Column 2</td> <td><button class="btn btn-primary edit-btn">Edit</button></td> </tr> <!-- Add more rows as needed --> </tbody> </table> ``` 3. Add JavaScript code to handle the edit functionality: ```javascript $(document).ready(function() { $('.edit-btn').click(function() { var row = $(this).closest('tr'); var columns = row.find('td[contenteditable="true"]'); if ($(this).text() === 'Edit') { columns.attr('contenteditable', 'true'); $(this).text('Save'); } else { columns.attr('contenteditable', 'false'); $(this).text('Edit'); // Perform save operation or update data using AJAX if required } }); }); ``` This example allows you to edit the content of the table cells by clicking the "Edit" button in each row. When the button is clicked, the contenteditable attribute of the cells is toggled between true and false, allowing editing or preventing further editing. You can customize this code according to your specific requirements.

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值