Hair spray. You can put an old towel on the back side of the stain if you don't want it to possibly spread to other parts of the pants while you are treating the stain. Just spray some hair spray on it, let it sit for a few minutes and then wash.
Most of the time, it will come out the first time around. But once or twice I have had to reapply the hairspray again after washing, so check before you put them into the dryer.