Answer the question
In order to leave comments, you need to log in
Why write e.preventDefault()?
Wrote code for dragging an element from one div to another , but didn't understand why write e.preventDefault() (wrote from the tutorial).
Here are the lines of code with e.preventDefault():
function dragOver(e){
e.preventDefault();
}
function dragEnter(e){
e.preventDefault();
this.className += ' hovered';
}
{
background: #f4f4f4;
border-style: dashed;
background-color: salmon;
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question