Error while building toggle functionality using button and input



  • https://codepen.io/sath08/pen/JjjXWKV?editors=1010
    here i am trying to build edit label like in google keep where category has add icon on the left and and done icon on the right
    when i click on add it has to focus on the input box and when i click on the cross icon where add icon was (i toggled it) it has to remove any text on input box and get back to initial state.
    i get error for

    TypeError: _vm.focusOn is not a function
    
    TypeError: _vm.focusOff is not a function
    

    here this error arises on console however the functionality does work for first 2 or 3 clicks then the change in icon does not work and i keep getting these error
    The solution I need is the focus on input must chnage icon from add to cross and get same result when I try to gain the functionality from add button. And vice versa when i click on outside and lose focus of input



  • @sath26 i’m not getting the error in your codepen.



  • thanks… but i have solved it… the problem was i used method instead of methods.@metalsadman


Log in to reply