Show bootstrap alert after an item

0

I have the following div that contains a input with its respective id :

<div class="form-group linea numBoxCaja 1">
  <div class="input-group">
     <span class="input-group-addon"><i class="fa fa-user"></i></span>
        <input type="text" class="form-control input-lg" id="caja1" name="caja1" 
        value="">
  </div>
</div>

I want to show a bootstrap alert after input when certain action occurs, I have it as follows:

$(".input-group #" + idCajaIden).after('<div class="alert alert-warning">strong>ADVERTENCIA!</strong> Filtro/Bolsa ya existe!.</div>');

But when the sample is as follows:

How can I show the alert of the box correctly without it being so ugly and embedded?

Thank you very much for the help.

    
asked by Baker1562 20.02.2018 в 20:44
source

1 answer

1

the code is correct but you must assign it to the parent (.input-group) and not the input itself

$(".input-group #" + idCajaIden).parent().after('<div class="alert alert-warning">strong>ADVERTENCIA!</strong> Filtro/Bolsa ya existe!.</div>');

add parent ()

greetings

    
answered by 20.02.2018 / 21:07
source