我在3.1.1中使用表单控制反馈范围中的链接来执行
javascript函数.我正在尝试升级到3.3.5,但表单控件反馈的行为发生了变化.
SNIPPET
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet" /> <div class="form-group has-Feedback"> <label class="control-label sr-only" for="rename"></label> <input value="hello" id="rename" type="text" maxlength="255" class="form-control name-check"> <span class="form-control-Feedback" style="top: 0px;right: 44px;"> <a class="pointer" onclick="alert('I love u')"><small>cancel</small></a> <a class="pointer" onmousedown="save=true;" click="alert('i love u too')"><small><i>save</i></small></a> </span> </div>
SNIPPET
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet" /> <div class="form-group has-Feedback"> <label class="control-label sr-only" for="rename"></label> <input value="hello" id="rename" type="text" maxlength="255" class="form-control name-check"> <span class="form-control-Feedback" style="top: 0px;right: 44px;"> <a class="pointer" onclick="alert('I love u')"><small>cancel</small></a> <a class="pointer" onmousedown="save=true;" click="alert('i love u too')"><small><i>save</i></small></a> </span> </div>
我查了一下,在3.3.5中添加了一个z-index:2.我试图通过设置更大的数字来覆盖它,但它不起作用.
你有什么想法让它再次起作用吗?任何解决方法?
解决方法
这很简单,在3.3.5中,类.form-control-Feedback有指针事件:none,这使得该元素不可点击.
请参阅v3.3.5的代码段
.form-group .form-control-Feedback { top: 0; right: 44px; pointer-events: initial; /* or - auto // or - unset */ }
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet" /> <div class="form-group has-Feedback"> <label class="control-label sr-only" for="rename"></label> <input value="hello" id="rename" type="text" maxlength="255" class="form-control name-check"> <span class="form-control-Feedback"> <a class="pointer" onclick="console.log('I love u')"><small>cancel</small></a> <a class="pointer" onmousedown="save=true;" onclick="console.log('i love u too')"><small><i>save</i></small></a> </span> </div>