Azo dyes, used in large quantities in drinks, have become a threat to human health. In the treatment of dyes, the method of chemical adsorption is often used due to its simple and efficient features. Covalent organic frameworks (COFs) material with the characteristics of stability and porosity has great potential for the adsorption of azo dyes. However, the application of COFs is severely limited by their poor mechanical properties and hard recovery. By the strategy of in situ growth using the original functional groups of the sponge, COFs are successfully grafted onto melamine sponges to give rise to a porous sponge@COFs material. The material can adsorb up to 621 mg g−1 of Congo red, a common azo dye. In addition, it exhibits strong adsorption of iodine solution with the saturated adsorption of 1504.76 mg g−1. More importantly, sponge@COFs can selectively adsorb azo dyes with S–O- bond. The adsorption mechanism is inferred as the connect of S–O- in the Congo red molecule with O atom of sponge@COFs. Also, the mechanism of iodine adsorption is explained to be due to the coordination of C atoms in COFs with I atom. In addition, as an adsorbent, the material is recoverable, stable and heat resistant. Relying on the stronger performance and lower cost, sponge@COFs is expected to be developed as a new adsorbent.