You must use positive reinforcement. These occasions need to be pointed out to little ones. Children enjoy feeling pleasant and well-behaved. It makes them proud to hear others comment on what nice children they are. This method not only will help in preventing tantrums, but it will help build your child's self-confidence for future years.
Nothing is a better learning tool than observation.
Let him or her stop and get a good look and the tantrum-thrower, noting the redness of their face, the embarrassment of their parents, and the annoyed expressions of the other people that are witnessing the event. Your child will definitely not want to be connected in any way to that bratty, embarrassing image. Reinforce the message you are trying to convey to your little one. Tell your child that he or she is starting to look like that other tantrum-haver. A toddler has a much better memory than they are sometimes given credit for.