S.P.
I have had this problem before, too. I used vinegar, but did not spray my plants...I placed the vinegar in a bottle near the plant. It attracts the gnats and kills them. There are also natural plant sprays that you can buy that are not harmful to plants, children, or pets. :) Hope this helps!