Solar panels capture sunlight and convert it to electricity ... It's like a magnetic field: just as the opposite poles of two magnets attract each other, so do the positive and negative charges ...