Although there have been notable advances in adhesive materials, the ability to program attaching and detaching behavior in these materials remains a challenge. Here, we report a borate ester polymer hydrogel that can rapidly switch between adhesive and nonadhesive states in response to a mild electrical stimulus (voltages between 3.0 and 4.5 V). This behavior is achieved by controlling the exposure and shielding of the catechol group through water electrolysis–induced reversible cleavage and reformation of the borate ester moiety. By switching the electric field direction, the hydrogel can repeatedly attach to and detach from various surfaces with a response time as low as 1 s. This programmable attaching/detaching strategy provides an alternative approach for robot climbing. The hydrogel is simply pasted onto the moving parts of climbing robots without complicated engineering and morphological designs. Using our hydrogel as feet and wheels, the tethered walking robots and wheeled robots can climb on both vertical and inverted conductive substrates (i.e., moving upside down) such as stainless steel and copper. Our study establishes an effective route for the design of smart polymer adhesives that are applicable in intelligent devices and an electrochemical strategy to regulate the adhesion.