A bracket device includes a supporting frame, a bracket, an elastic member and a fastening member. The bracket is movably connected to the supporting frame. The elastic member is mounted to the supporting frame. The fastening member is connected to the elastic member. When the bracket is located at a first position relative to the supporting frame, the fastening member is in a locking state. When the bracket is located at a second position relative to the supporting frame, the fastening member is in an unlocking state.