I have to make a bunch of checks based on ID's of some elements, but those all differ a little.

So I made a bunch of functions, and instead of always having to repeat `$(this).children ...` I wanted to have a short variable for that. But when I declare it outside the actual function, I get `undefined`.

Isn't the code supposed to work like: Hmm, so there's a variable using *this*, and right now *this* is a *list*, then I'll become `$('ul').children ...` ? 
What logic is it following and how should I fix it?

Minified example of issue:

```js
$(document).ready(function() {
  var thisID = $(this).attr('id');

  function replaceContent(id) {
    $('#' + id).html('new content, and the ID is: ' + thisID);
  }

  $('button').on('click', function() {
    alert(thisID);
    // replaceContent(thisID);
    replaceContent(hello);
  })
});
```

```html
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div id="hello">abc</div>

<div id="result"></div>

<button>button</button>
```

<https://jsfiddle.net/2kduy9vp/84/>