title: Focus back on input after click button
body: <p>So I have an input text and a button. When I focus on the input and I click on the button next, I want the button to do some stuff (like clearing the input value) then focus back on the input. (And I have a blur event doing some stuff too)</p>
  
  <p>I've been trying a <code>$('input').focus();</code> inside my <code>$('button').on("mousedown", function() {});</code> but it doesn't work</p>
  
  <p><strong>EDIT : Sorry for the answer I've been posting, I'm new on the StackOverflow !</strong>
  Here is what I've been trying with your code and my blur event. But it's not working ! How can I make it work please ?</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>var button = $("button");
  button.on("click", function(){
    var name = $("#name")
    name.val("");
    name.focus();
  });
  
  $("input").on("blur", function(e){
    button.hide();
    e.preventDefault();
    e.stopPropagation();
  });
  
  $("input").focus(function(){
    button.show();
  });</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"&gt;&lt;/script&gt;
  &lt;input id="name" placeholder="Name" autocomplete="off"&gt;
  &lt;button type="button"&gt;Submit&lt;/button&gt;</code></pre>
  </div>
  </div>
  </p>