I need a button next to a select input, how to do it?

0

I need a button next to a select 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> 
    
asked by anonymous 08.06.2016 / 20:48

2 answers

1

Use the capabilities of the bootstrap itself.

Add a class "row" 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>
    
26.05.2017 / 14:26
0

Assuming your button is out of div , you should take into account that the div element has display: block , so it has a line just for it, so it should change to display: inline-block % or display: inline , so you can put 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>
    
08.06.2016 / 21:00