How to use var javascript in innerHTML?
<p>How to use a javascript variable when setting the <code>innerHTML</code> of an element? To see my problem first click <code>CLICK 1</code>. This will show <code>delete</code> and then click <code>delete</code>. Why does the alert not show <code>111-aaaa,1</code>? How can I do that?</p>

<p><a href="https://jsfiddle.net/brf75wvp/" rel="nofollow">https://jsfiddle.net/brf75wvp/</a></p>

<pre><code>&lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"&gt;&lt;/script&gt;

&lt;input id="test_id" value="1"/&gt;
&lt;div onclick="test_fn1()"&gt;CLICK 1&lt;/div&gt;
&lt;div id="demo"&gt;&lt;/div&gt;

&lt;script&gt;
    function test_fn1() {
        var test_id_val = document.getElementById("test_id").value;
        document.getElementById("demo").innerHTML = "&lt;span onclick= delete_fn('111-aaaa, test_id_val')&gt;delete&lt;/span&gt;";
    };
&lt;/script&gt;

&lt;script&gt;
    function delete_fn(no_delete) {
        alert(no_delete);
    };
&lt;/script&gt;
</code></pre>