Abstract Ulcerative colitis (UC) is a chronic inflammatory bowel disease. UC treatments are limited by significant adverse effects associated with non‐specific drug delivery, such as systematic inhibition of the host immune system. Endoscopic delivery of a synthetic hydrogel material with biocompatible gelation that can efficiently cover irregular tissue surfaces provides an effective approach for targeted drug delivery at the gastrointestinal (GI) tract. An ideal integration of synthetic material with intestinal epithelium entails an integrated and preferable chemically bonded interface between the hydrogel and mucosal surface. In this study, a photo‐triggered coupling reaction is leveraged as the crosslinking platform to develop a mucosal‐adhesive hydrogel, which is compatible with endoscope‐directed drug delivery for UC treatment. The results demonstrated superior spatiotemporal specificity and drug pharmacokinetics with this delivery system in vivo. Delivery of different drugs with the hydrogel leads to greatly enhanced therapeutic efficacy and significantly reduced systemic drug exposure with rat colitis models. The study presents a strategy for targeted and persistent drug delivery for UC treatment.