Most electronic fobs have a small switch at the back or bottom that allows you to remove the internal key. Then you can use a flat-head screwdriver to gently pry apart the two halves
of the fob to access the battery compartment and replace it.
If you drive a pre-2008 Corolla, you will need a CR2016 battery. Otherwise, you may need a CR2032, CR1620, or CR1632 battery depending on your model year and type of key fob.
Water can damage the electronics inside a key fob. If it got really wet, you may find that the fob does not work even after you replace the batteries. In this case, visit a dealership for help.