I'm trying to add a script
tag as value of a variable within a script
.
that is ..
<script>
$(document).ready(function() {
var iCnt = 0;
$('#btAdd').click(function() {
if (iCnt <= 19) {
iCnt = iCnt + 1;
var div = '<div id="node' + iCnt + '" class="item">'+ iCnt +'</div>';
var jsplmb = '<script> jsPlumb.ready(function() { addPlumb("node'+ iCnt +'") });</script>';
$('#diagramContainer').after(div);
}
});
});
</script>
which is not working. The close script tag
in the variable jsplumb
act as the close tag
of main script tag
.
also the dynamic addition of var div
is not adding to
<div id="diagramContainer"> </div>