I want to add a script at the end of a tag but it is not working. Here I have already added script so it's working. https://code.sololearn.com/W5A4a14A7a38/?ref=app Here I have tried to add script later but it's not working. https://code.sololearn.com/Wa40a24A03A1/?ref=app (desktop)
1/23/2021 4:32:08 PM
harshit6 Answers
New Answerharshit You can try like this function addScript( src ) { var s = document.createElement( 'script' ); s.setAttribute( 'src', src ); document.body.appendChild( s ); } document.addEventListener("DOMContentLoaded", function(event) { addScript ("https://platform.twitter.com/widgets.js"); });
I Am AJ ! Do you know why my code is not working, it was working with normal html but not with script.
harshit On Sololearn I don't think dynamic script will work but on desktop browsers sure it will work because we are already doing like that.
I Am AJ ! This is not working in desktop also. https://code.sololearn.com/Wa40a24A03A1/?ref=app
Btw. the problems seems to be that Sololearn interprets the JS as HTML if it includes a script tag for some reason...
SoloLearn Inc.
4 Embarcadero Center, Suite 1455Send us a message