The CP violating two-Higgs doublet model of type-X may enhance significantly the electric and magnetic moment of leptons through two-loop Barr-Zee diagrams. We analyze the general parameter space of the type-X 2HDM consistent with the muon $g-2$ and the electron EDM measurements to show how strongly the CP violating parameter is constrained in the region explaining the muon $ g-2$ anomaly.