A
A
AlexAll2020-05-03 12:04:16
JavaScript
AlexAll, 2020-05-03 12:04:16

How to display the result of a js script in the same place where it is inserted on the page?

Hello, there is a js script that collects a DIV block and you need to display it in the same place where there will be such a js that calls it

<script type="text/javascript" async="async" src="//site.local/uploads.js"></script>


How to do it?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
AlexAll, 2020-05-03
@AlexAll

Here is the solution
let script = document.currentScript;
script.parentNode.insertBefore(div, script);

D
Dmitry Belyaev, 2020-05-03
@bingo347

https://developer.mozilla.org/ru/docs/Web/API/Docu...
pay attention to Notes

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question