2

I tried to add an @click to a font awesome icon. However, whether I add an @click event to span or i tag, it doesn't work at all. I suspect the event is taken by the input field. How can I make the magnifier icon clickable?

<div class="control has-icons-right">
    <input  v-model="keyword" @keyup.enter="findName" class="input is-large" type="text" placeholder="Input 1 word, hit Enter"/>
    <!-- or 2 words separated by space -->                      
      <span class="icon is-right" @click="findName">
        <i class="fa fa-search"></i>
      </span>
</div>

Source: 3sName.com

Benny Chan
  • 730
  • 1
  • 8
  • 24

3 Answers3

3

It is because, you are using bulma class .icon which having the following css.

pointer-events: none;

Try to override it with

pointer-events: all;

pointer-events css will prevent your element from emitting a click event.

:)

Stark Buttowski
  • 1,799
  • 2
  • 10
  • 21
0

use a button / anchor 'a' instead span to wrap the fa-icon, along with @click method? Span isn't good practice for click event as well.

SC Kim
  • 545
  • 4
  • 14
0

Have you tried @click.prevent="findName" modifier?

arcil
  • 41
  • 7