title: How to call a custom function as part of a jQuery function chain
body: <p>This seems like such a straight-forward thing to do, but I can't find a <strong>jQuery</strong> function to handle this.</p>
  
  <p>For example, </p>
  
  <pre><code>$('div').show().sayHi()
  
  function sayHi(obj) {
      obj.html('hi')
  }
  </code></pre>
  
  <p><code>sayHi()</code> is not a <strong>jQuery</strong> function so it can't be called in this context. 
  You would need to call it like:</p>
  
  <pre><code>var $div = $('div').show()
  sayHi($div)
  </code></pre>
  
  <p>But I want it as part of the chain, mostly because it looks nicer.</p>
  
  <p><em><strong>Solution:</strong></em></p>
  
  <p>Answer from Barmar best answers this specific question, but my implementation was a more reusable option, as shown in <a href="https://stackoverflow.com/a/42565944/627457">my answer below.</a> </p>