I want to keep focuing state after click a button. Keeping state means:
- If <input/>is focused, keep focus after clicking the button;
- If <input/>is not focused before, don't focus it after clicking the button.
So, after clicking, as current focusing state of the <input/> is always 'not focus', I want to get the previous focusing state of the <input/>.
The problem is that blur is always called before click event.
What I have tried:
// onclick event
this.$iptPassword.on('click', this.toggleShowPassword);
// callback
toggleShowPassword() {
    console.log(this.$iptPassword.is(':focus')); // always return false
    this.$iptPassword.attr('type', this.$iptPassword.attr('type') === 'password' ? 'text' : 'password');
}
 
    