I am facing an issue where I want to trigger a function upon leaving an input field. The input in question is set up using vue-bootstrap-typeahead
. Upon inspecting the DOM, I found that the structure of the input element looks like this:
<div id="myElement">
<div class="input-group input-group-sm">
<input type="search" autocomplete="off" class="form-control">
Here is the code snippet for reference:
<vue-bootstrap-typeahead
id="myElement"
v-model="plateNumberFilter"
:data="plateNumberOptions"
size="sm"
required
@blur="myFunctionIsnnotTriggered"
@hit="returnPlateNumberId()"
/>
I tried adding the id="myElement"
directly to the typeahead component, but it ends up in the surrounding div
instead of the actual input
tag.
This leads me to three questions:
- How can I add an @blur event listener to the
vue-bootstrap-typeahead
input field? - Is there a way to assign an
id
to the input within avue-bootstrap-typeahead
component? - What is the best approach to add an eventListener to the
input
tag inside thevue-bootstrap-typeahead
component?
You are welcome to address any or all of these questions. It would be greatly appreciated to have solutions for all three challenges.