moved click function inside doc ready