This seems like such a straight-forward thing to do, but I can't find a **jQuery** function to handle this.

For example, 

```
$('div').show().sayHi()

function sayHi(obj) {
    obj.html('hi')
}

```

`sayHi()` is not a **jQuery** function so it can't be called in this context. 
You would need to call it like:

```
var $div = $('div').show()
sayHi($div)

```

But I want it as part of the chain, mostly because it looks nicer.

***Solution:***

Answer from Barmar best answers this specific question, but my implementation was a more reusable option, as shown in [my answer below.](https://stackoverflow.com/a/42565944/627457)