A simple and convenient method to synthesize N-[(2-hydroxyl)-propyl-3-trimethylammonium] chitosan chloride in an ionic liquid.