Take a bowl, a saucer or a plate big enough for the opening of the glass.
Slice a piece of lime or lemon and rub it gently around the rim.
Another way to moisten rim is to dip it in water. Add water in a saucer. Flip the glass and press it in the water.
Get another saucer add salt, sugar or any dry ingredient you desire. Turn glass upside down and gently press in salt or sugar. This technique will get salt and sugar inside the rim. Use a paper towel or your finger to remove it if you don't like it.
You can avoid getting salt or sugar inside the rim by tilting the bowl and glass on one side and slowly rotating the glass around.