Javascript not executing on elements in html.erb
<p>I have a Javascript file that adds an SVG to an html element. It works both standalone and in a Python app.</p>

<p>When I try to add it to the Rails app the javascript doesn't seem to do anything, though I can see the minimized version of it using Firefox's Inspect sources. I have added the file to /app/assets/javascripts and application.js has <code>//= require_tree .</code></p>

<p>I think the problem is probably with <strong>my index.html.erb</strong>, my code looks like this:</p>

<p></p>

<pre><code>&lt;script&gt;
 var retention_data = &lt;%= @retention_results.to_json.html_safe %&gt;;
&lt;/script&gt;

&lt;div&gt;&lt;div&gt;

    &lt;div class="tab-pane fade active in" id="dashboard"&gt;
    &lt;div class="row" id="retention"&gt;&lt;/div&gt;
    &lt;/div&gt;



    &lt;div id="popup"&gt;
        &lt;table&gt;&lt;/table&gt;
    &lt;/div&gt;
    &lt;div id="selectioninfo"&gt;
        &lt;table&gt;&lt;/table&gt;&lt;button id="savedata" class="btn btn-primary"&gt;Save data&lt;/button&gt;
    &lt;/div&gt;           


    &lt;script src=
    "https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.4/jquery.min.js"&gt;
    &lt;/script&gt;
    &lt;script src=
    "https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"&gt;
    &lt;/script&gt;

&lt;/div&gt;
&lt;/div&gt;
</code></pre>

<p></p>

<p>The javascript file adds to element '#dashboard' and works outside of Rails. Do I need to include the <code>&lt;script src=...</code> and <code>&lt;link rel=...</code> lines? Is there something wrong with my index.html.erb?</p>