3

I have the following code that produces this: enter image description here

 <div class='input-group manualInput'>
       <input id='address-input' type='text'  class='form-control' placeholder='Enter your current location!'/>
       <span class='input-group-addon'>
          <i class='glyphicon glyphicon-search'></i>
       </span>
  </div>

How do I make the glyphicon clickable? And call a JS function

2 Answers 2

6

Add a JavaScript onClick event like this:

<span class='input-group-addon'>
    <i class='glyphicon glyphicon-search' onclick="myfunction();"></i>
</span>
0

Right off their website:

<div class="input-group">
    <input type="text" class="form-control" placeholder="Search for...">
    <span class="input-group-btn">
        <button class="btn btn-default" type="button">Go!</button>
    </span>
</div><!-- /input-group -->
1
  • 1
    Instead of down-voting my answer that someone else up-voted at the time, why don't you try editing my answer to fix it? This answer was from four years ago anyway, I'm sure Bootstrap has changed since then. Jan 30, 2020 at 23:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.