How do you look after caterpillars in a jar?
Well, whenever I kept a caterpillar like that, it always died. I usually did that and put a bunch of leaves in there for him to munch on. As for water, I used to just put a tiny drip on one of the leaves and hoped for the best:) My advice... keep him for a night, but then let him go the next day.
Another Answer: If you're going to keep a caterpillar for a pet, make sure you research what type of plant it eats. The Butterfly website (http://butterflywebsite.com/) has photos of caterpillars as well as butterflies. Caterpillars are very specific as to which host plants they eat, so do your research to help it grow to full size so it can morph into a chrysalis.
As long as they have enough food and there is some air flow into the jar, they should be fine. They don't particularly care whether there are other caterpillars there or not in most cases. The most important thing to remember is to clean out the frass from the bottom of the jar so it doesn't start molding. That will kill off the caterpillars really fast.