Swaping elements in js(drag and drop) | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Swaping elements in js(drag and drop)

Can somebody help to understand swapping elements? I know basics of dragging and dropping but can't do swapping.

9th Oct 2020, 10:18 AM
Otabek Karimov
Otabek Karimov - avatar
1 Answer
+ 5
https://code.sololearn.com/Whq9rPnTy5BK/?ref=app In this old code of mine I have used a swap function. function swap() { var a = document.getElementById('first').value; document.getElementById('first').value = document.getElementById('second ').value; document.getElementById('second').value = a; } I hope I have been helpful.
9th Oct 2020, 10:42 AM
Gabriele Gatti
Gabriele Gatti - avatar