How to add class "form-control" to generated bootstrap-tags-input?

560 views Asked by At

Im using bootstrap tags input inside a modal that i display after ajax call.

Now i want to add class "form-control" to the generated input tag.

I tried like this :

$(".bootstrap-tagsinput > input").addClass('form-control');

but it dosent work for me.

Here is the input generated :

<div class="bootstrap-tagsinput">
   <input type="text" placeholder="">
</div>

Any ideas please ?

1

There are 1 answers

2
Simone Rossaini On

You don't need > symbol

$(".bootstrap-tagsinput input").addClass('form-control');
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div class="bootstrap-tagsinput">
  <input type="text" placeholder="">
</div>

Reference: