title: Rails partial with Javascript listener works on home page but no where else
body: <p>I solved this part:  see <strong>So I got it to work</strong> below for new problem.  Following is the initial problem for reference and context: 
  I have a custom.js file in app/javascript folder.  I have a bit of code that adds a listener for a player:  </p>
  
  <pre><code>// Add Listeners 
    document.getElementById('file').addEventListener('change', handleFileSelect, false);
    list.addEventListener("click", function(e)
      {
        audio.src = e.target.dataset.additionalInfo;
      });
  </code></pre>
  
  <p>The audio player is rendered as a partial. 
  The target for the audio source is set by the listener when the user clicks the list item.  The list item code (included in the partial) is: <code>&lt;li data-additional-info= &lt;%=track_url%&gt;&gt;&lt;%= sanitize_filename(track.key) %&gt;&lt;/li&gt;</code></p>
  
  <p>Everything works beautifully for rendering the partial on the home page, but when I try to render the partial on a different page (in addition to the home page), everything works except the listener, so I get the list items as I should but they are not clickable to load a selected file into the player.</p>
  
  <p>my application.html.rb has the following code loading javascript  </p>
  
  <pre><code>&lt;%= javascript_include_tag 'application', 'data-turbolinks-track' =&gt; true %&gt;
  &lt;%= csrf_meta_tags %&gt;
  </code></pre>
  
  <p><strong>So I got it to work</strong>..sort of.  Here's my silly error. I was using advice from this <a href="http://intuio.at/en/blog/dont-use-data-attributes-to-find-html-elements-with-js/" rel="nofollow">post:</a></p>
  
  <p>I went back to the post and followed the instructions.  Ichanged the event listener from above to the following:</p>
  
  <pre><code>var list = document.querySelector('.js-interactive-list');
  
    list.addEventListener("click", function(e)
      {
        audio.src = e.target.dataset.additionalInfo;
      });
  </code></pre>
  
  <p>Not paying enough attention to detail is a killer...<strong>but now</strong> if i play the file on one page and navigate to the other page that holds the same partial, I have to do a browser refresh to get it to play on the new page.</p>