+ 3

HTML tag question

Can we use <artice> instead of <div> in this code given below? <!DOCTYPE HTML> <html> <head> <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> </html>

5th Aug 2020, 4:18 PM
Vishal Pandey
2 Respostas
+ 4
I think it's possible, but maybe not the cleanest solution, since it would not contain an *article*.
5th Aug 2020, 5:12 PM
Sandra Meyer
Sandra Meyer - avatar
+ 2
Yes true ! Thanks for giving answer 😊
6th Aug 2020, 9:20 AM
Vishal Pandey