Answer the question
In order to leave comments, you need to log in
How to get the contents of a script tag?
There is a local script attached to the document via a script tag - is it possible and how to copy the contents of this tag and paste it into another script tag?
Answer the question
In order to leave comments, you need to log in
Add id r to the script or find its selector
var script=document.getElementById("id-script");
var scriptTarget=document.getElementById("id-script-target");
scriptTaget.innerText=script.innerTarget; // скрипт не будет исполнен, так как этот элемент уже был загружен.
// более правильно будет создать элемент скрипта и добавить его на страницу
var s=document.createElement("script");
s.innerText=script.innerText;
document.body.appendChild(s);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question