A novel voriconazole (VCZ)‐loaded injectable hydrogel was in situ synthetized via a Schiff base reaction between polyaldehyde dextran (PAD) and carboxymethyl chitosan (CMCTS) for intraocular drug loading and release. Water‐insoluble VCZ, which is an effective agent in clinic treating fungal endophthalmitis, was loaded through the inclusion into the β‐cyclodextrin (β‐CD) cavity based on host‐guest interaction on the linear poly β‐CD chain, which was in situ twined in the cross‐linked hydrogel structure. The gelation time, degradation, and drug release process were investigated by studying three kinds of hydrogels with different volume ratio of PAD to CMCTS resolving in phosphate buffered saline (PBS) solution (3:7, 6:7, 9:7), respectively. The property of VCZ‐loaded injectable hydrogel should be adjusted through changing the cross‐linked density of the hydrogel, the molecular weight or concentration of the linear poly β‐CD to meet the treating requirement, and a multistage drug controlled‐release mechanism was proposed. In conclusion, the VCZ‐loaded in situ injectable hydrogel should be offered as a promising strategy for intraocular drug delivery in vitreous cavity for the treatment of fungal endophthalmitis. © 2019 Wiley Periodicals, Inc. J Biomed Mater Res Part A: 107A: 1909–1916, 2019.