A pH-responsive hydrogel with potent antibacterial activity against both aerobic and anaerobic pathogens.