-2

Ok so I want to fire a jquery event, after a user types in the search box.

Search box:

<div class="input-group">    
    <input type="search" class="form-control ui-autocomplete-input searchField-active ui-autocomplete-loading" placeholder="Sök på Dustin" name="filter.query" accesskey="s" autocomplete="off" id="searchBox">
    <span class="input-group-btn">
        <button type="search" name="search" id="searchTrigger" class="btn btn-default">
            <span class="icon-search"></span>
        </button>
    </span>
</div>

After a user types in the searchbox fire this jQuery:

$(".hidden").removeClass('hidden');
Hbaecklund
  • 261
  • 1
  • 4
  • 16
  • Demo [this](https://jsfiddle.net/mmushtaq/ekhT4/2347/) and [this](https://jsfiddle.net/mmushtaq/5Assc/897/) – mmushtaq Aug 29 '16 at 07:06

2 Answers2

1

You can use onchange or onkeyup events to call function

<input type="search" class="form-control ui-autocomplete-input searchField-active ui-autocomplete-loading" placeholder="Sök på Dustin" onkeyup="RemoveClass()" name="filter.query" accesskey="s" autocomplete="off" id="searchBox">

<script>
    function RemoveClass() {
        $(".hidden").removeClass('hidden');
    }
</script>
Mairaj Ahmad
  • 14,434
  • 2
  • 26
  • 40
1

This below code perform operation whenever user gives input to the search box.

$("#searchBox).on({
   input :function () {

                 $(".hidden").removeClass('hidden');

           }
});
Dipak Thoke
  • 1,963
  • 11
  • 18