A button installed on a housing of an electronic device includes a keycap, a button frame, a waterproofing ring, and at least one installation post. The button frame is latched with the keycap and defines at least one through hole. The waterproofing ring is disposed within the at least one through hole. At least one installation post is received through the waterproofing ring and resists against the keycap.