A bracket device includes a longitudinal wall, an end wall, a mounting member, a protruded lug, a blocking member and an elastic member. The end wall is connected to the longitudinal wall. The mounting member is connected to the end wall. The protruded lug is arranged on the longitudinal wall and includes a supporting section. The blocking member is movably mounted to the protruded lug, and includes a blocking part and an extension part. The extension part is configured to abut against the supporting section of the protruded lug. The elastic member is configured to provide an elastic force to the blocking member for holding the blocking part of the blocking member at a predetermined position relative to the end wall.