I have a sample.js
file which contains
document.write('This is a sample text');
And I have this script <script src="https://example.com/sample.js"></script>
in external website. Where-ever I use this script, sample.js
is loaded immediately.
But I want to load the above script in multiple Html <div>
or other elements, where we define something like id="example"
or class="example"
or data-sample-js
So how do I modify the sample.js
file to achieve this.