'97 Dakota Stalls while Idling in Drive, but NOT Neutral or Park

Hey, I have a 1997 Dodge Dakota V8 (automatic) with about 140k and live in Vermont. Recently, my truck will konk out while I am sitting at a red light. As I’m sitting there, the RPM’s keep going down below 700, until finally stalling out completely. When I shift into Park/Neutral then turn ignition, it will start right back up again. To get around this, I have been shifting into Neutral while I wait at the light, then back into Drive when it turns green. I have recently installed a new battery and exhaust system. I am wondering if this is occuring because of worn plugs, a dirty air filter, cracked vaccum hose, or bad alternator? Any advice will be GREATLY appreciated. This truck is in great shape otherwise, and I hope I can fix this problem fast and cheap!! Thanks!
John

I’d vote for the Idle Air Control Valve.
http://www.2carpros.com/articles/how-idle-air-control-valve-works

Got codes?

I fixed the problem! Total Cost $15.00 Here’s what I did, and the stalling STOPPED:

-Used Carb Cleaner to clean out IAC Valve & “Butterfly” Valve
-Put in a new air filter
-Used steel wool to clean off battery terminals

Now it runs smooth! Thanks for the tip!