Why does this line of script not work?
<p>When data-word is called I want a sound and an image to show and play. I have tried many different ways but can't figure it out.</p>

<p>Here is one way...</p>

<pre><code>for(i = 0; i &lt; ul.children.length; ++i){

listOfWords[ul.children[i].getAttribute("data-word")] = ul.children[i].getAttribute("data-pic", "data audio");

}
 console.log(listOfWords);
</code></pre>

<p>I have also tried...</p>

<pre><code>for(i = 0; i &lt; ul.children.length; ++i){

listOfWords[ul.children[i].getAttribute("data-word")] = ul.children[i].getAttribute("data-pic");
listOfWords[ul.children[i].getAttribute("data-word")] = ul.children[i].getAttribute("data-audio");


}
console.log(listOfWords);
</code></pre>

<p>But no such luck. </p>

<p>The second way does the bottom but not the top, I need both the data-audio and the data-pic when the data-word is called.</p>

<p>Can anyone help? </p>

<p>HTML...</p>

<pre><code>&lt;ul style="display:none;" id="wordlist"&gt;
  &lt;li data-word="mum" data-audio="http://www.wav-sounds.com/cartoon/daffyduck1.wav" data-pic="http://pixabay.com/static/uploads/photo/2012/04/13/00/06/head-31117_640.png"&gt;&lt;/li&gt;
  &lt;li data-word="cat" data-audio="http://www.wav-sounds.com/cartoon/porkypig1.wav" data-pic="http://pixabay.com/static/uploads/photo/2012/05/03/23/13/cat-46676_640.png"&gt;&lt;/li&gt;
  &lt;li data-word="dog" data-audio="http://www.wav-sounds.com/cartoon/porkypig1.wav" data-pic="http://pixabay.com/static/uploads/photo/2012/05/02/21/14/gray-46364_640.png"&gt;&lt;/li&gt;
  &lt;li data-word="bug" data-audio="http://www.wav-sounds.com/cartoon/porkypig1.wav" data-pic="http://pixabay.com/static/uploads/photo/2012/04/16/12/17/black-35741_640.png"&gt;&lt;/li&gt;
  &lt;li data-word="log" data-audio="http://www.wav-sounds.com/cartoon/daffyduck1.wav" data-pic="http://pixabay.com/static/uploads/photo/2012/04/13/11/18/fire-31929_640.png"&gt;&lt;/li&gt;
  &lt;li data-word="dad" data-audio="http://www.wav-sounds.com/cartoon/daffyduck1.wav" data-pic="http://pixabay.com/static/uploads/photo/2012/04/13/00/05/old-31110_640.png"&gt;&lt;/li&gt;
</code></pre>

<p></p>
