Bootstrap 4 Radio within a label and invalid-feedback

1

I'm working with Bootstrap 4 and I'm having a little problem with radio buttons

The case, is that I need that the input of type radio have a id empty

For which, I work in the following way

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">

<label class="custom-control custom-radio">
  <input type="radio" value="true" name="ejemplo" class="custom-control-input">
  <span class="custom-control-label">Con neutro</span>
</label>

<label class="custom-control custom-radio mb-3">
  <input type="radio" value="false" name="ejemplo" class="custom-control-input">
  <span class="custom-control-label">Sin neutro</span>
</label>
<div class="invalid-feedback">Hay un error!</div>

<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>

My problem is that by adding the class is-invalid to the input, the div.invalid-feedback is still not displayed (if used with id in input and label for , it works correctly )

Is there any way to do this without having to use JavaScript?

Thank you!

    
asked by Juan Salvador Portugal 29.08.2018 в 17:35
source

1 answer

0

: valid e: invalid are selectors of CSS classes. This is the root of the conflict.

CSS: invalid selector

If you rename the class, it looks perfectly: Fiddle

    
answered by 31.08.2018 в 13:19