How to attach my lens cap to my camera?

I have a Nikon D3100 and I'm wondering if anyone knows any ways I can attach my lens cap to my camera body. I don't want to lose it and the camera itself didn't come with anything to attach it with.

Get a lens cap leash

I ordered a lens cap on a string. I have ordered 1 for each lens I own. I kept the other lens cap as a back up. Each of my lens takes a different size lens cap.

What you could do is if the cap has a place to attach a string just us any string or lanyard you have and attach it to the camera where you can I guess, but you'll probably just need to make sure you put the cap on the lens tightly and use a good case so in transit you don't lost it by accident
I had the same problem and eventually tied the lens cap to my camera strap instead of the camera itself

For 30 years, I just slipped my lens cap into my hip pocket, and haven't lost one yet, but I suppose that's a little clichéd.

You don't.
Either leave the lens on the body with the lens cap on the front of it, or buy a Nikon body cap, easily available online or from Nikon dealers. If you buy a body cap you might also want to buy a lens base cap as well.
It's very common and highly annoying that with camera and lens combos the manufacturers are increasingly prone to save a tiny amount of cash by no longer supplying lens base caps and camera body caps.
- What kind of lens adapter do I need for my Vivitar lens to attach to my nikon d40?
- Can i attach a Pentax Camera lens to my Nikon d3000?
- Does attach lens to dslr all the time good for maintain the camera?
- Nikon D3100. Will a 52mm lens cap fit my lens?
- Will leavin the lens cap off my DSLR for 3+ weeks damage the lens?