moved click function to displayPosts in order to remedy problem; didn't work