It grabs elements that match the following criteria:
divs with an id of "first"
<div id="first">
divs with a class of "first"
<div class="first">
any element that has an name attribute whose value ends in first and is immediately the child of an "ol" that has an id of items
<ol id="items">
<li name="first">
<li name="testfirst">
Honestly, this query is not a good one. First off, all ids should be unique on the page, so "div#first" can just be #first. Next, the last part of the query with "ol#items > [name$='first']" reeks of bad semantics. The only element allowed directly under "ol" is "li". "li" can hold whatever, but "ol" should only have "li" direct children. Also name is not a "li" attribute, so that isn't semantic either. Of course, I know that sometimes we are not allowed to touch the HTML, so you may have to just deal with it.
$("div#myUnique\\$0\\$")
Looks silly, but the two slashes are necessary. When your selector sees "div#myUnique$0$", it will toss it out, saying it is invalid. So if you were to escape it once, "div#myUnique\$0\$", JavaScript is going to jump in, because "\" is a escape character for JavaScript as well. So when Javascript sees that, it will replace it with "div#myUnique$0$", which we already know our selector with toss out. Therefore, we need to escape the escape character. This way it will turn into this:
| Code | Javscript Sees | ID selector looks for |
| "div#myUnique\\$0\\$" | "div#myUnique\$0\$" | "myUnique$0$" |