title: How to pass $(this) properly in click jQuery function
body: <p>I am trying to make a tictactoe project in jQuery and I am having a major problem...</p>
  
  <p>The tiles are in <code>&lt;td&gt;</code> tags and I am trying to make it so that when the user clicks the the tile, it calls the "marked" function. </p>
  
  <p>If we now look into the "marked" function, <code>$(this)</code> is intended to be the <code>&lt;td&gt;</code> node that the function was called from. </p>
  
  <p>However, it wasn't doing anything so I checked the console and apparently <code>$(this)</code> was containing the DOM Window object. </p>
  
  <p>Is there anyway I can send the right kind of <code>$(this)</code> to the "marked" function?</p>
  
  <p>Thank you!</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  
      var TURN_X = false;
      var TURN_O = true;
  
      var turn = false;  // this is to see whos turn it is.
  
      $(document).ready(function(){
  
          var listCells = $.makeArray($("td"));
          $("td").click(function(){marked(listCells)});   //THIS IS WHERE I HAVE PROBLEMS
          return false;
      });
  
      function marked(arr)
      {
          console.log($(this));  // THIS CONSOLE LOG RETURNS "DOM Window"
          $(this).addClass("marked");
  
          if(turn == TURN_X)
          {
          this.innerHTML = "X";
          turn = false;
          }
          else
          this.innerHTML = "O";
  
          var tileNum = $(this).attr("id");
      }
  </code></pre>