Pack jalapenos and garlic into three hot 1-pint jars to within ½ in. of the top.
In a large saucepan, bring sugar, vinegar, seasonings and, if desired, cayenne pepper to a boil.
Reduce heat; simmer, uncovered, 5 minutes.
Carefully ladle hot liquid over pepper mixture, leaving ½-in. headspace.
Remove air bubbles and adjust headspace, if necessary, by adding hot mixture.
Wipe rims.
Center lids on jars; screw on bands until fingertip tight.
Place jars into canner with simmering water, ensuring that they are completely covered with water.
Bring to a boil; process for 15 minutes.
Remove jars and cool.
