Using attr(id) after finding closest element through class

I'm new to js/jQuery and found a couple of posts that already helped me a lot with what I'm trying to accomplish. But I'm stuck on this particular problem.

What I want to do is that when I click on the box with the class ".moreInfo", jQuery should find the closest element with the class ".make-3D" and return the id of it. The background is that I have several divs with ".make-3D" including the ".moreInfo" and I want to save the make-3D-ID in a variable that I then hand over to a function so that I can use one trigger event for all .moreInfo-classes. But, I always get an "id is not defined" error.

Here is my basic code (I tried it also with $(this) instead of $( but from what I read I figured would be the better choice?):


$(".moreInfo").click(function () {
   var card = $(".make-3D").attr(id);


<div id="test" class="make-3D">
   <div class="tile">
      <div class="front">
         <div class="head">
         <div class="location">
         <div class="picContainer">
         <div class="moreInfo">
            <b>More Info!</b>
      <div class="back">