use jQuery and avoid syntax edge cases

thanks to @hnrch02 for the suggestion
for @hnrch02