How do I install a new gas cap? The old cap has a cord attached to it. on 2005 Saturn Ion

I want to try putting on a new gas cap and see if that will correct the issue of the "check engine light" to come on. I had issues with this in the past, and to pass the emission test one year, a new one was put on.

Asked by for the 2005 Saturn Ion