Js Check If Button Is Clicked Javascript For Loop