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>
jsplmbdoes nothing and is never used.div.. its not working (the html elements are not adding )#diagramContainerUse of getPreventDefault() is deprecated. Use defaultPrevented instead. Is the problem . Any way its not working even after coping your entire code. But its work inJS Bin