Search box with button (Bootstrap 3)

twitter-bootstrap, twitter-bootstrap-3

Solution

Remove pull-right class from `<div class="input-group-btn pull-right">`

<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<form action="/hms/accommodations" method="GET"> 
  <div class="row">
    <div class="col-xs-6 col-md-4">
      <div class="input-group">
        <input type="text" class="form-control" placeholder="Search" id="txtSearch"/>
        <div class="input-group-btn">
          <button class="btn btn-primary" type="submit">
            <span class="glyphicon glyphicon-search"></span>
          </button>
        </div>
      </div>
    </div>
  </div>
</form>

Problem

I want to create a search box with a button on it's side, like the this: But just on the right side of the page. So I put pull-right and this is how my code like: ``` <form action="/hms/accommodations" method="GET"> <div class="input-group pull-right"> <input type="text" class="form-control" placeholder="Search" id="txtSearch"/> <div class="input-group-btn pull-right"> <button class="btn btn-primary" type="submit"> <span class="glyphicon glyphicon-search"></span> </button> </div> </div> </form> ``` and when I tried to run it, this is how it looks like: Why is does the alignment like that? I hope someone can help me. Thank you.

Original source