Hydrogels from a combination of imidazole and urea hydrogen bonding interactions are turned off by metal complexation and anion binding.