Suppose you have assigned a reference to a web page element to the variable cupcake. You have also written a function called cupcakeDrag that should run when users drag other elements on top of the cupcake element and a function called cupcakeDrop that should run when users release the other element on the cupcake. To allow users to move draggable page elements to the cupcake element and drop them there, what JavaScript code should you add to your program? Question options: A cupcake.addEventListener("dragover", cupcakeDrag); cupcake.addEventListener("drop", cupcakeDrop); B cupcake.ondragstart = cupcakeDrag; cupcake.ondrop = cupcakeDrop; C cupcake.addEventListener("drop", cupcakeDrop); cupcake.addEventListener("dragover", cupcakeDrop); D cupcake.ondrag = cupcakeDrag; cupcake.ondragend = cupcakeDrop;
Suppose you have assigned a reference to a web page element to the variable cupcake. You have also written a function called cupcakeDrag that should run when users drag other elements on top of the cupcake element and a function called cupcakeDrop that should run when users release the other element on the cupcake. To allow users to move draggable page elements to the cupcake element and drop them there, what JavaScript code should you add to your program?
Question options:
A |
cupcake.addEventListener("dragover", cupcakeDrag); cupcake.addEventListener("drop", cupcakeDrop); |
B |
cupcake.ondragstart = cupcakeDrag; cupcake.ondrop = cupcakeDrop; |
C |
cupcake.addEventListener("drop", cupcakeDrop); cupcake.addEventListener("dragover", cupcakeDrop); |
D |
cupcake.ondrag = cupcakeDrag; cupcake.ondragend = cupcakeDrop; |
Trending now
This is a popular solution!
Step by step
Solved in 2 steps