neknek mouh
neknek mouh

Reputation: 1802

search icon inside search box

So what I have right now is this:

SAMPLE

But I want to include icon-search ICON SEARCH inside the textbox on the left side.

This is my code:

<form class="navbar-form pull-left form-search">
    <select>
        <option>Search patient by...</option>
        <option name="fname">Firstname</option>
        <option name="fname">Lastname</option>
        <option name="fname">Last follow up</option>
    </select>
    <div class="input-append">
        <input data-provide="typeahead" data-items="4"  type="text" 
           class="span2 search-query">
        <button class="btn">Search</button>
    </div>
</form>

So any ideas how to achieve this? Thanks.

Upvotes: 7

Views: 41028

Answers (3)

Chtioui Malek
Chtioui Malek

Reputation: 11515

you can do something like :

HTML :

<form class="navbar-form pull-left form-search">
<div class="input-append">
  <i class="icon-zoom-in"></i>
        <input data-provide="typeahead" data-items="4"  type="text" 
           class="span2 search-query">
        <button class="btn">Search</button>
    </div>
  </form>

CSS :

.icon-zoom-in
{
  position:relative;
  left:20px;
  top:-8px;
  z-index:999;
}

try it : https://refork.codicode.com/xb70

Upvotes: 0

RbG
RbG

Reputation: 3193

<input data-provide="typeahead" data-items="4"  type="text" class="search-query">

.search-query{
   background: url(../images/your_pic.format) no-repeat left ;
}

Just add that image as background aligned left with no-repeat

Upvotes: 4

user2021917
user2021917

Reputation:

Check this Fiddle

<form class="navbar-form pull-left form-search">
  <div class="input-append">
    <input data-provide="typeahead" data-items="4"  type="text" class="span2 search-query" style="background:url(http://twitter.github.io/bootstrap/assets/img/glyphicons-halflings.png) no-repeat -38px 9px">
    <button class="btn">Search</button>
  </div>
</form>

As you can see there are other icons also showing. You have to use separate "search image" for your textbox.

Upvotes: 2

Related Questions