title: jQuery cannot get id from $(this) button click
body: <p>I am trying to use <code>jQuery</code> (<code>this</code>) to get the id of a button clicked and pass that id to a function to do something with. I have three buttons all with  different id's and was hoping to use <code>$(this)</code> as I am learning it but cannot get it to work no matter what way I try it
  This is the code</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;html&gt;
  &lt;title&gt;QuizMaster&lt;/title&gt;
  &lt;head&gt;
   &lt;meta name="viewport" content="width=device-width, initial-scale=1.0"&gt;
   &lt;script src="jquery-3.1.0.min.js"&gt;&lt;/script&gt;
  &lt;script&gt;
   function player(x){
    var player = x;
    console.log(player);
   }
  
   $(document).ready(function(){
    $('#button').click(function(){
     var x = $(this).id;
     player(x);
    });
   });
  &lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
   &lt;form id='button'&gt;
    &lt;input type='button' id='reset' value='Reset'&gt;
    &lt;input type='button' id='player1' value='Player1'&gt;
    &lt;input type='button' id='player2' value='Player2'&gt;
   &lt;/form&gt;
  &lt;/body&gt;
  &lt;html&gt;</code></pre>
  </div>
  </div>
  </p>