Fixing jquery bugs with onclick.