CHanged some line in JS to jQuery