I need to put a button next to an input of type select, how to do?

Asked

Viewed 3,966 times

0

I need to put a button next to a select type input. My code:

                       <div class="form-group col-md-2">    
                          <label for="inpIdPortador">ID Portador:</label>      
                            <select class="form-control" id="inpIdPortador">
                                <option value="1">Port 1</option>
                                <option value="1">Port 2</option>
                            </select>   
                        </div> 

2 answers

1


Use the resources of the bootstrap itself.

Add an "Row" class before calling the form-group and activate the col-Md classes-*'

<form>
....
   <div class="row">    
       <fieldset class="form-group col-md-8">
           <label for="inpIdPortador">ID Portador:</label>
           <select class="form-control" id="inpIdPortador">
               <option value="1">Port 1</option>
               <option value="2">Port 2</option>
           </select>
       </fieldset>
       <fieldset class="form-group col-md-4">
           <button type='button' class='btn btn-default btn-block'></button>
       </fieldset>
   </div>
</form>

0

Assuming your button is outside the div, it should be taken into account that the div owns the display: block, This makes it have a line just for her, so it should change to display: inline-block or display: inline, so it will be possible to place the button next to your select

.form-group{
		display: inline-block;
}
<div class="form-group col-md-2">    
	<label for="inpIdPortador">ID Portador:</label>      
	<select class="form-control" id="inpIdPortador">
		<option value="1">Port 1</option>
		<option value="1">Port 2</option>
	</select>   
</div>
<button>Botão</button>

Browser other questions tagged

You are not signed in. Login or sign up in order to post.