Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Link in form-control-feedback can't be clicked in Bootstrap 3.3.5

I was using links in form-control-feedback span to perform javascript functions since 3.1.1. I'm trying to upgrading to 3.3.5, but the behavior for the form-control-feedback changed.

Please refer to the Working JsFiddle 3.1.1

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>&nbsp;<a class="pointer" onmousedown="save=true;" click="alert('i love u too')"><small><i>save</i></small></a> 	
  </span>
</div>

and to the Not Working JsFiddle 3.3.5

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>&nbsp;<a class="pointer" onmousedown="save=true;" click="alert('i love u too')"><small><i>save</i></small></a> 	
  </span>
</div>

I checked, there is a z-index:2 added in 3.3.5. I tried to override it by setting to a bigger number, but it doesn't work.

Do you have any thoughts to make it work again? Any workarounds?

like image 210
Aiden Zhao Avatar asked Mar 10 '16 19:03

Aiden Zhao


1 Answers

That's simple, in 3.3.5 the class .form-control-feedback has pointer-events:none which makes that element not clickable.

see a snippet with 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>&nbsp;<a class="pointer" onmousedown="save=true;" onclick="console.log('i love u too')"><small><i>save</i></small></a> 	
  </span>
</div>
like image 122
dippas Avatar answered Oct 28 '22 08:10

dippas