Eighteen men from Boston and nearby suburbs were arrested after an online prostitution sting conducted by Boston police, Suffolk District Attorney Daniel F. Conley said Tuesday. After sting operations Jan. 24 and 31, the men were arrested on charges of offering to pay for sex in cash or drugs, Conley’s office said. All were charged with seeking sex for a fee. Seven faced additional charges of possession of Class B or E narcotics with intent to distribute, prosecutors said. The men arrested in the first sting were arraigned in Boston Municipal Court between Jan. 27 and 29, and those from the second were arraigned in South Boston Municipal Court Tuesday, Conley’s office said.