当鼠标点击的时候给该元素$(this)添加一个class.然后执行完之后移除;给拥有该class的元素添加事件即可;
1 //layer的父子页面之间,子页面传值给父页面; 2 $('#yes').on('click',function(){ 3 var $$ = parent.layui.jquery;//关键 4 var result=$('#cron').val(); 5 var index = parent.layer.getFrameIndex(window.name); //获取窗口索引 6 parent.layer.close(index); 7 $$('.flag').val(result); 8 })
$(document).on('click','.myCronExpressE',function(){ $(this).addClass('flag'); layer.open({ title:'Cron生成器', type: 2, skin: 'layui-layer-molv', shadeClose: true, shade: 0.3, maxmin:true, area: ['32%','55%'], offset:'r', content: "../../../html/taskManagement/flowExec/cron.html", end:function(){ $('.myCronExpressE').removeClass('flag');//关键 } }); });