Construction of fluorescent probes for zinc ion (Zn2+) and cadmium ion (Cd2+) is significant for the safety of humans. However, the discriminating recognition of Zn2+ and Cd2+ by a single probe remains challenging owing to their similar properties. Herein, a novel deoxycholic acid derivative containing 8‐hydroxyquinoline fluorophore has been facilely synthesized through click chemistry to form a clamp‐like probe. Using its perfect bonding cavity from 1,2,3‐triazole and quinoline, this molecule showed favorable solvent‐dependent fluorescent responses and distinguished Zn2+ and Cd2+ in different solvents. In ethanol aqueous solution, it displayed good selectivity and ratiometric fluorescence to Zn2+ with 30 nm spectroscopic red‐shifts. In acetonitrile aqueous solution, it exhibited good selectivity and ratiometric fluorescence to Cd2+ with 18 nm spectroscopic red‐shifts. Moreover, the unique microstructural features of the probe in assembly were used to reflect its recognition processes. Due to its merits of low detection limit and instant response time, the probe was utilized for sensing Zn2+ and Cd2+ in water, beer and urine with high accuracy. Meanwhile, this probe served as a handy tool and was employed to obtain inexpensive test strips for the prompt and semiqualitative analysis of Zn2+ and Cd2+ with the naked eye.