title: Get (ONLY) Id of input field using .getAttribute
body: <p>I have a list of check-boxes which all have unique ID's. When a button is pressed it should pass this list of ID's through to the back-end.
  I am able to get the ID's using the .getAttribute method but it includes other information which I don't need. Is there a way to get ONLY the id of that selected check-box?</p>
  
  <p>Here is the basic code that fires when the button is clicked:</p>
  
  <pre><code>            $('input[name = "dCodes"]:checked').each(function () {
                  selectedCodes.push($(this.getAttribute('id')));
              });
  </code></pre>
  
  <p>Here is what the selectedCodes array contains after the button is clicked:
  <a href="https://i.stack.imgur.com/v4uKY.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/v4uKY.png" alt="enter image description here"></a></p>