So basically if .search is empty. I want to hide .results
If .search has text inside it, i want to show .results
.search is a regular text input
â
I understand that âkeypressâ is wrong, but i have no idea what to replace it with. How do i create an active listener waiting for stuff to happen?
Like
>âdocumentâ : function (event){ do dis do dat }
Uhm, i dont know. Help me out dear meteor community!
I think you should use the âkeyupâ event. The âkeydownâ event triggers when the key is down and therefore the value of the key is submitted into the input only after the function is called.
Why is every one using jQ to get the values? e is already a jQ event/object so you can do just e.currentTarget.value - the .search is an input element right?
And the reason it is not working is simple jQ call does not return the string but the whole object within this making the call chainable, so you have to simply chain the call and do !template.$('.search').val(), but donât do that, you can save some CPU time by utilizing e.
I would do it on focus and pull the value from the search box. Have an if statement that checks what is in the value. If its blank then hide. else show search box