title: Pass argument to another function with javascript (this)
body: <p>I think that my element in renderGrid() contains an html element so I wanna replace "#container" with this. Simply I wanna make my code universal because now I can only use it for "#container" so "#container" has to be replaced with something like template.</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-js lang-js prettyprint-override"><code>function renderGrid(element, settings) {
      var x = settings.columns;
      var y = result.length / x;
  
      $('.grid').remove();
      for (var cols = 0; cols &lt; x; cols++) {
          for (var rows = 0; rows &lt; y; rows++) {
              numberOfTiles = x * y;
              $('#container').append("&lt;div class='grid'&gt;&lt;div class = 'usernameSpace'&gt;&lt;/div&gt;&lt;/div&gt;");
          };
      };
      $('.grid').width(800 / x);
      $('.grid').height(800 / x);
  }
  
  (function ($) {
      $.fn.tiles = function (options) {
       
          var settings = getOptions(options);
  
          return this.each(function () {
  
              var grid = renderGrid(this, options);
  
              fillTilesWithContent(this, options);
  
              colorTiles(this, options);
  
              columnCountSet(this,options);
              
              return grid;
          });
      }
  })(jQuery);</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"&gt;&lt;/script&gt;</code></pre>
  </div>
  </div>
  </p>