A bracket device includes a sidewall, at least one mounting member, an elastic member, and a fastening member is adjacent to the sidewall. The at least one mounting member is connected to the base. The fastening member is movably mounted on the sidewall, includes an engaging structure, can stay in a first state responsive to the elastic force provided by the elastic member, and can be switched from the first state to a second state by operation. The engaging structure of the fastening member is configured to engage with or be mounted to a target member.