An automatic opening-and-closing lid for a garbage bin includes a base member including an opening for a user throwing trash into the bin therefrom and first and second annular flanges. A lid is installed to the opening of the base member and is able to pivot with respect to the base member. A control is installed to the base member and includes a power source for power supply, a control panel, a driving member electrically connected to the control panel, a driven member and first and second sensor wires electrically connected to the power source. The first and second sensor wires are respectively disposed in the first and second annular flanges. A sensing region is formed proximal to the first and second sensor wires.