I don't think anyone was opposed to invading Afghanistan, and the dems largely supported Iraq in 2003 (granted, the country was fed false evidence). I'd say they only turned visibly anti-war shortly after the invasion and the capture of Sadat Hussein.
The War in Afghanistan was supported broadly by both parties.
Afghanistan was a sweep. Only one person -- Barbara Lee (D-Calif.) -- voted against it in Congress.
Iraq was a Republican President's war. In Congress, the Republicans voted for the war by 48-1. The Dems voted for the war by 29-21. The Independent voted against.