A positioning mechanism (100) configured for positioning a keypad (20) on a portable electronic device includes a plurality of retainers (10). Each retainer includes a main portion (11) and a fixing unit (12) formed on the main portion. The main portion includes an engaging surface (112) and an opposite latching surface (114). A protrusion (1121) is formed on the engaging surface, a first positioning surface (1122) corresponding to a first portable electronic device (30) is formed on the protrusion. The retainer is mounted to the keypad via the fixing unit.