what i am trying to do is to get the value from a textbox and load it into a container like so:
var script = $('#txtbox').val();
$('.container').html(script);
i also tried creating the script again with javascript by finding the values of the one the user inserted and creating a new one and appending it into the container as so:
var tempdiv = $("<div></div>").html($('#txtbox').val());
$(tempdiv).find('script').each(function(index,$element){
var script = document.createElement("script");
$.each($element.attributes, function(){
if (this.specified){
script.setAttribute(this.name, this.value);
}
});
script.innerHTML = $($element).html();
$('.container').append(script);
});
but still doesn't work, i get:
Failed to execute 'write' on 'Document': It isn't possible to write into a document from an asynchronously-loaded external script
Any suggestions? maybe try loading the script in iframe, refresh the DOM somehow or what?