Easily, clearly and simply explain to me the meaning of the code elements. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Easily, clearly and simply explain to me the meaning of the code elements.

<script> function allowDrop(ev) { ev.preventDefault(); } function drag(ev) { ev.dataTransfer.setData("text", ev.target.id); } function drop(ev) { ev.preventDefault(); var data = ev.dataTransfer.getData("text"); ev.target.appendChild(document.getElementById(data)); } </script> </head> <body> <div id="box" ondrop="drop(event)" ondragover="allowDrop(event)" style="border:1px solid black; width:200px; height:200px"></div> <img id="image" src="sample.jpg" draggable="true" ondragstart="drag(event)" width="150" height="50" alt="" /> </body> What means <script>? I don't understand whole code starting at <script> element and ending with the </body> element. <div> element, what is this? I thought HTML5 does not use <div> element because of <article>. What is functions? What is events? What is <div id="box"? Why it uses ondrop="drop(event)"? I don't understand nothing in Java-Script.

23rd Nov 2019, 2:17 PM
Orion
Orion - avatar
3 Answers
+ 3
We could explain this code.. bit it won't be of any use.. since you don't have javascript knowledge and not enough knowledge of HTML5.. So please first go through the courses https://www.sololearn.com/Course/JavaScript/?ref=app
23rd Nov 2019, 2:21 PM
Мг. Кнап🌠
Мг. Кнап🌠 - avatar
+ 1
Learn in the following order: 1. HTML 2. CSS 3.JavaScript
23rd Nov 2019, 4:50 PM
Vasilis Karapas
Vasilis Karapas - avatar
0
@Sami Khan I understood whole code except "functions", thought that I should finish HTML5 first and then go to JavaScript.
23rd Nov 2019, 2:23 PM
Orion
Orion - avatar