If you want to wing it... you can.
Terry, if it will help you. A couple of days ago I was in Yellowstone. I did not plan to stay in the park, in fact, I had no idea where I was going to stay. Same for the Tetons.
At the Visitor Centres in Jackson and West Yellowstone (on different days) I asked the ladies behind the desk what my options were for camping. Told them to start with BLM, then State Forests, State Parks, National Forests and as a last resort RV Park.
In both cases I got onto fantastic campgrounds and had the option of electricity as well. (Didn't take it.) Both offices told me of lots of options of campgrounds which they knew were not full. The campgrounds call in with how many spots they have left. All were within 6 or 8 miles of the park entrances.
In the Tetons it was actually in the NP, but not after you have paid your entry. Six miles south of Moose Jnctn, and 12 miles out of Jackson.
For Yellowstone I was a mere two miles north of West Yellowstone, and a simple and quick drive into the park.
Lifey
Get the right visitor centre.
Don't go to the Tetons NP Visitor Centre. Go to Yellowstone Visitor Centre in Jackson, northern end of town, on the main drag.
[Keep all your empty drinking water bottles. You can fill them there.]
Lifey
Road Closures in Yellowstone
I came across this information on roads that will be closed in Yellowstone after Labor Day:
https://www.nps.gov/yell/planyourvisit/parkroads.htm