Add JS hook to templates