0

enter image description here

Getting syntax error on simple javascript :

<script type="text/javascript">  
document.write("JavaScript is a simple language for javatpoint learners");  
</script> 
Helping Hands
  • 5,292
  • 9
  • 60
  • 127
  • 1
    Maybe JavaScript is not that simple language after all ..? But definitely JS should not contain HTML tags. – Teemu Apr 28 '20 at 12:44
  • @Teemu - Of course not. I mean to say my program is simple. – Helping Hands Apr 28 '20 at 12:45
  • 2
    You need to remove the script tags - it looks like it expects pure script – mplungjan Apr 28 '20 at 12:46
  • You are right but now in that case if I want to import some JS via SRC before my script, how I can do that if it wont accept < > tags. – Helping Hands Apr 28 '20 at 12:49
  • You can create a script element in the current document and set its src to that remote script URL. – wOxxOm Apr 28 '20 at 12:52
  • @wOxxOm - any example please? I did look at most of SO questions but still unable to import my external JS from which are here : https://grapesjs.com/docs/getting-started.html#import-the-library – Helping Hands Apr 28 '20 at 12:54
  • 1
    [document.createElement("script") synchronously](https://stackoverflow.com/a/3248500) – wOxxOm Apr 28 '20 at 12:56
  • Why not use a playground like jsfiddle.net or codepen.io? – mplungjan Apr 28 '20 at 13:00
  • @mplungjan - Because I am trying to drag and drop element on this page : https://grapesjs.com/demo.html , So I think I have to open that page and execute javascript from same chrome tab, else it wont work. – Helping Hands Apr 28 '20 at 13:08

0 Answers0