Fixed Typo and better example

There is a $ missing in the JS code.

I also added two lines from the referenced function, to make clear, that you do not have to add it at the beginning of this function but after the first two lines.
Merge remote-tracking branch 'origin/2.2' into 2.2