Act immediately. The most important thing you can do with a behavior like this is regain control as soon as possible. As soon as your toddler hits you, there needs to be an action from you. This could vary, depending on your child, the severity of the incident, and your parenting methods. Whether you put your child in timeout, leave the location, or something else entirely, it needs to be done right away. Let your toddler know you mean business.
Toddlers like pushing buttons. This is how they learn how to interact with people. Remember that while very smart, this is a stage where kids are trying to understand which behaviors are acceptable. They will be very persistent and will also test you to see what they can get away with. Some may do it more in public because they feel you are more vulnerable to quickly placating them. Whatever you let them do is what they will believe to be correct. If smacking you gets a giggle or a request, this behavior will be repeated. I once had a friend who unintentionally taught her toddler to hit her on the leg every time he wanted her attention. If she didn't comply, he kept at it until she gave in. She would joke about how cute it was. It wasn't cute anymore when he attempted the same trick with a teacher.
Toddlers repeat what they see. If you use spanking as discipline in your home, your toddler could be repeating the behavior. They also could be repeating what a friend or sibling does. Perhaps she saw hitting on TV. Just because your toddler is hitting you, it doesn't mean she hates you. She may simply be repeating an action she saw elsewhere. If you don't want your toddler to hit you or anyone else, do your best not to let her be around that behavior.
Everyone will know best. If your toddler hits you in public, be prepared for advice from all sides. Any and every one will have their thoughts on the matter. It's a natural instinct, especially for fellow parents, to speak up on such matters. Some thoughts may be lighthearted. But other words may sting. For your toddler's sake, keep cool. If you see things are headed in the wrong direction, it's best to leave the scene. The worst thing you can do when your toddler is hitting is to cause other negative behaviors, such as arguing.
Emphasize the pain. Even if it doesn't hurt much when your toddler hits you, he needs to know that it can. Now this does not mean you should hit him back. That's not a very positive thing to do and if you're in public (or even in private) it could land you discipline time, instead of your toddler. There are other ways to model feelings. Make sad faces and also ask your toddler what it feels like when he gets hit by someone. Make it clear that hitting gets the bad attention, not the good attention. Compare hitting to hugs and ask your toddler which one he likes better. Answer with a "me too" when he chooses hugs. Then, give him a big hug and tell him you hope he gives you lots more of those every day.
*I originally published this via Yahoo Contributor Network