title: Data attribute selector to output from multidimensional array
body: <p>This is the first question I am posting so apologies if it's in the wrong format.</p>
  
  <p>Here is my 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-js lang-js prettyprint-override"><code>var words = [ ["first"],["second"],["third"] ];
  
  $('.categories li a').click(function() {
      $('.output').empty();
      $(this).toggleClass('active');
      var myEm = $(this +".active").data('words');
      alert(myEm);
      $('.output').append(words[myEm]);
  });</code></pre>
  <pre class="snippet-code-css lang-css prettyprint-override"><code>.active {
    color: red;
  }</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;
  &lt;ul class="categories"&gt;
    &lt;li&gt;&lt;a data-words="0"&gt;First&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a data-words="1"&gt;Second&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a data-words="2"&gt;Third&lt;/a&gt;&lt;/li&gt;
  &lt;/ul&gt;
  
  &lt;div class="output"&gt;&lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>So First, Second and Third are my categories, if you select "First" I want it to output the first array in my html, which is working fine. The issue I am having is I want to have it so if the user selected "First" and "Second" it outputs both of those arrays, but it just chooses the "First" array. Is it an each function I need to use to achieve this?</p>
  
  <p>Hope I have explained this well enough.</p>
  
  <p>Your help is appreciated.</p>
  
  <p>Thanks</p>