It turns out that `$` (above) is a short-hand for `$(document).ready(..)`.  Probably best to combine the two functions.