Simplify my Code please

Simplify my Code please

Hi Guys,
I am new to this forum. And as I am not very experienced in working with jQuery I have a maybe stupid question:

So I have multiple  checkboxes on my page each one has a unique id.
some of them also have a class called show-more
if i click a checkbox with class show-more
a fieldset with the class name that is equal to the  id of checkbox with class show-more is shown (second class of fieldset is "field")

so my code looks like that:
First I check all the id if they are checked (only the one with class show-more)
if($("#id1").attr("checked"))
    {
        $(".id1").show();

    }
    else
    {
        $(".id1").hide();
    };
I do this for id2, id3 and so on

then I give these the elements a click function
$("#id1").click
    (
        function()
        {
            if($("#id1").attr("checked"))
            {
                $(".id1").show();

            }
            else
            {
                $(".id1").hide();
            }
        }
    );
again I do this for all the elements that I need

so my source codes gets very long.

How can I shorten this