The trouble began when the 8th grader sat down, heard a popping sound and then noticed smoke.
Responding fire officials praised the student for remembering to "stop, drop and roll."
She quickly got rid of the pants, while a teacher brought a blanket.
She was released from the hospital and is back home.