Monday, June 3, 2024
 Popular · Latest · Hot · Upcoming
145
rated 0 times [  152] [ 7]  / answers: 1 / hits: 16008  / 8 Years ago, mon, december 19, 2016, 12:00:00

I have a series of Bootstrap buttons like this:



<button :disabled=page === lastPage type=button class=btn btn-default @click=getPage(lastPage)>
<span class=glyphicon glyphicon-forward></span>
</button>


But the first line of the getPage method does not work:



event.target.blur();


Which is very strange, because I have another button in another component, on which event.taget.blur() works perfectly:



<button class=btn btn-default pull-right @click=show() type=button>Batch
<span :class={'glyphicon glyphicon-chevron-down': showForm, 'glyphicon glyphicon-chevron-up': !showForm}></span>
</button>


Does anyone know why this might be?



EDIT: I think it's when I click inside the SPAN that the blur doesn't work.



EDIT: oh well I solved it - I also need event.target.parentNode.blur() as well.


More From » vue.js

 Answers
2

You likely want to use



event.currentTarget.blur()


That will always be the element you attached the event listener to where as event.target is the element the event originated from.


[#59652] Friday, December 16, 2016, 8 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
joannam

Total Points: 331
Total Questions: 106
Total Answers: 105

Location: Sweden
Member since Mon, May 8, 2023
1 Year ago
joannam questions
Thu, Dec 9, 21, 00:00, 3 Years ago
Mon, Dec 7, 20, 00:00, 4 Years ago
Fri, Jun 19, 20, 00:00, 4 Years ago
Fri, Dec 13, 19, 00:00, 5 Years ago
;