Question: When did it become a tradition to stand for the national anthem?

Disambiguated questions and answers:
context: When the U.S. national anthem was first recognized by law in 1931, there was no prescription as to behavior during its playing. On June 22, 1942, the law was revised indicating that those in uniform should salute during its playing, while others should simply stand at attention, men removing their hats. The same code also required that women should place their hands over their hearts when the flag is displayed during the playing of the national anthem, but not if the flag was not present. On December 23, 1942, the law was again revised instructing men and women to stand at attention and face in the direction of the music when it was played. That revision also directed men and women to place their hands over their hearts only if the flag was displayed. Those in uniform were required to salute. On July 7, 1976, the law was simplified. Men and women were instructed to stand with their hands over their hearts, men removing their hats, irrespective of whether or not the flag was displayed and those in uniform saluting. On August 12, 1998, the law was rewritten keeping the same instructions, but differentiating between "those in uniform" and "members of the Armed Forces and veterans" who were both instructed to salute during the playing whether or not the flag was displayed. Because of the changes in law over the years and confusion between instructions for the Pledge of Allegiance versus the National Anthem, throughout most of the 20th century many people simply stood at attention or with their hands folded in front of them during the playing of the Anthem, and when reciting the Pledge they would hold their hand (or hat) over their heart. After 9/11, the custom of placing the hand over the heart during the playing of the national anthem became nearly universal.
question: When did it become a tradition to stand at attention for the national anthem?
short_answers: June 22, 1942
wikipage: The Star-Spangled Banner

context: When the U.S. national anthem was first recognized by law in 1931, there was no prescription as to behavior during its playing. On June 22, 1942, the law was revised indicating that those in uniform should salute during its playing, while others should simply stand at attention, men removing their hats. The same code also required that women should place their hands over their hearts when the flag is displayed during the playing of the national anthem, but not if the flag was not present. On December 23, 1942, the law was again revised instructing men and women to stand at attention and face in the direction of the music when it was played. That revision also directed men and women to place their hands over their hearts only if the flag was displayed. Those in uniform were required to salute. On July 7, 1976, the law was simplified. Men and women were instructed to stand with their hands over their hearts, men removing their hats, irrespective of whether or not the flag was displayed and those in uniform saluting. On August 12, 1998, the law was rewritten keeping the same instructions, but differentiating between "those in uniform" and "members of the Armed Forces and veterans" who were both instructed to salute during the playing whether or not the flag was displayed. Because of the changes in law over the years and confusion between instructions for the Pledge of Allegiance versus the National Anthem, throughout most of the 20th century many people simply stood at attention or with their hands folded in front of them during the playing of the Anthem, and when reciting the Pledge they would hold their hand (or hat) over their heart. After 9/11, the custom of placing the hand over the heart during the playing of the national anthem became nearly universal.
question: When did it become a tradition to stand at attention and face in the direction of the music for the national anthem?
short_answers: December 23, 1942
wikipage: The Star-Spangled Banner

context: When the U.S. national anthem was first recognized by law in 1931, there was no prescription as to behavior during its playing. On June 22, 1942, the law was revised indicating that those in uniform should salute during its playing, while others should simply stand at attention, men removing their hats. The same code also required that women should place their hands over their hearts when the flag is displayed during the playing of the national anthem, but not if the flag was not present. On December 23, 1942, the law was again revised instructing men and women to stand at attention and face in the direction of the music when it was played. That revision also directed men and women to place their hands over their hearts only if the flag was displayed. Those in uniform were required to salute. On July 7, 1976, the law was simplified. Men and women were instructed to stand with their hands over their hearts, men removing their hats, irrespective of whether or not the flag was displayed and those in uniform saluting. On August 12, 1998, the law was rewritten keeping the same instructions, but differentiating between "those in uniform" and "members of the Armed Forces and veterans" who were both instructed to salute during the playing whether or not the flag was displayed. Because of the changes in law over the years and confusion between instructions for the Pledge of Allegiance versus the National Anthem, throughout most of the 20th century many people simply stood at attention or with their hands folded in front of them during the playing of the Anthem, and when reciting the Pledge they would hold their hand (or hat) over their heart. After 9/11, the custom of placing the hand over the heart during the playing of the national anthem became nearly universal.
question: When did it become a tradition to stand for the national anthem, with hand over the heart and removing hat?
short_answers: July 7, 1976
wikipage: The Star-Spangled Banner

Long answers:
knowledge: content: Since 1998, federal law (viz., the United States Code 36 U.S.C. § 301) states that during a rendition of the national anthem, when the flag is displayed, all present including those in uniform should stand at attention; non-military service individuals should face the flag with the right hand over the heart;
wikipage: The Star-Spangled Banner

content: The law further provides that when the flag is not displayed, all present should face toward the music and act in the same manner they would if the flag were displayed.
wikipage: The Star-Spangled Banner
long_answer: When the United States national anthem was first recognized by law in 1931, there were no guidelines related to behavior during its playing. However, on June 22, 1942, the law was revised indicating that those in uniform should salute during the playing of the national anthem, while others should simply stand at attention, with men removing their hats. The same code also required that women should place their hands over their hearts when the flag is displayed during the playing of the national anthem but not if the flag were not displayed. On December 23, 1942, the law was again revised instructing men and women to stand at attention and face in the direction of the music of the national anthem when it is played. This revision also directed men and women to place their hands over their hearts only if the flag were displayed. Additionally, those in uniform were required to salute. Then, on July 7, 1976, the law was simplified. Men and women were instructed to stand with their hands over their hearts, with men removing their hats, regardless of whether or not the flag were displayed. Since 1998, federal law states that during a rendition of the national anthem, when the flag is displayed, all present, including those in uniform, should stand at attention. Additionally, non-military service individuals should face the flag with their right hand over their heart. The law further provides that when the flag is not displayed, all present should face towards the music and act in the same manner they would if the flag were displayed.