I teach JS. What is the essence. There is an input search (.search-input). initially hidden. There is a button (.search) when you click on it. It is necessary to make it so that when the button is clicked, it appears, and when clicked on the page, it disappears. That is, addClass and removeClass. I tried to implement it like this:
<script type="text/javascript"> $(function(){ $('.search').click(function(){ $('.search-input').addClass('show'); $(!'.search').click(function(){ $('.search-input').removeClass('show'); }); }); }); </script> but confused. tell me the correct solution, if possible, with reference to the source.