mercredi 30 mai 2018

Bootstrap search box click

I added the following HTML using Bootstrap 4

    <div class="col-sm-3 col-md-3 search-header">
    <form class="navbar-form" role="search">
        <div class="input-group">
            <input type="text" class="form-control search-box " placeholder="Search" name="srch-term" id="srch-term">
            <div class="input-group-btn">
                <button class="btn btn-default btn-search" onclick="ss()"><i class="glyphicon glyphicon-search"></i></button>
            </div>
        </div>
    </form>
</div>

When the search button is clicked, the whole page refreshes, I added the OnClick() event and bind it to ss() (a custom function that only alerts) but the form still refreshing.

I need to bind the search button to some JavaScript function. How to?




Aucun commentaire:

Enregistrer un commentaire