because when solid NaCl or KCl are put in water they dissolve and dissociate into Na+ and Cl- ions (or K+ and Cl-). These ions allow electrons to be transferred within water and create a potential difference to be created between the anode and cathode of an electric circuit. In the solid form these two ions are not separated so electron transfer is poor thus electricity conduction is poor.
An electrolyte is a material that dissolves in water to give a solution that conducts an electric current.
It is any substance containing free ions that behaves as an electrically conductive medium. Because they generally consist of ions in solution, electrolytes are also known as ionic solutions, but molten electrolytes and solid electrolytes are also possible.
NaCl and KCl dissociate into ions in water thus they can conduct electricity...