Bootstrap Tutorial - Put search icon near textbox








The following code shows how to put search icon near textbox.

Example

<!DOCTYPE html>
<html>
<head>
<script type='text/javascript'
  src='http://code.jquery.com/jquery-2.0.2.js'></script>
<link rel="stylesheet" type="text/css"
  href="http://getbootstrap.com/dist/css/bootstrap.css">
<script type='text/javascript'
  src="http://getbootstrap.com/dist/js/bootstrap.js"></script>
<link rel="stylesheet" type="text/css"
  href="http://maxcdn.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css">
<style type='text/css'>
.input-group-unstyled input.form-control {
  -webkit-border-radius: 4px !important;
  -moz-border-radius: 4px !important;
  border-radius: 4px !important;
}<!--from  www .j av  a2s  .  co m-->
.input-group-unstyled .input-group-addon {
  border-radius: 4px;
  border: 0px;
  background-color: transparent;
}
</style>
</head>
<body>
  <div class="container">
    <div class="row">
      <!-- Validation -->
      <div class="form-group col-lg-4">
        <div class="form-group has-feedback">
          <label class="control-label" for="inputValidation">Validation
          </label> <input type="text" class="form-control" id="inputValidation"
            placeholder="Search" /> <span
            class="glyphicon glyphicon-search form-control-feedback"></span>
        </div>
      </div>
      <!-- Input Group -->
      <div class="col-lg-4">
        <div class="form-group">
          <label class="control-label" for="inputGroup">Input Group </label>
          <div class="input-group">
            <input type="text" class="form-control" placeholder="Search"
              id="inputGroup" /> <span class="input-group-addon"> <i
              class="fa fa-search"></i>
            </span>
          </div>
        </div>
      </div>
      <!-- Unstyled Input Group -->
      <div class="col-lg-4">
        <div class="form-group">
          <label class="control-label" for="inputGroup">Unstyled
            Input Group</label>
          <div class="input-group input-group-unstyled">
            <input type="text" class="form-control" placeholder="Search"
              id="inputGroup" /> <span class="input-group-addon"> <i
              class="fa fa-search"></i>
            </span>
          </div>
        </div>
      </div>
    </div>
  </div>
  <!-- Post Info -->
  <div
    style='position: fixed; bottom: 0; left: 0; background: lightgray; width: 100%;'>
    About this SO Question: <a
      href='http://stackoverflow.com/a/24682653/1366033'>Put search
      icon near textbox bootstrap</a> <br />Fork This Skeleton Here: <a
      href='http://jsfiddle.net/KyleMit/kcpma/'>Bootstrap 3.0 Skeleton</a>
    <br />
    <div>
</body>
</html>

Click to view the demo