Categories
HTML

How to disable drag and drop on HTML elements?

Spread the love

Sometimes, we want to disable drag and drop on HTML elements.

In this article, we’ll look at how to disable drag and drop on HTML elements.

How to disable drag and drop on HTML elements?

To disable drag and drop on HTML elements, we set the draggable attribute to false.

For instance, we write

<div draggable="false"></div>

to set the draggable attribute to false so that the div can’t be dragged.

Conclusion

To disable drag and drop on HTML elements, we set the draggable attribute to false.

By John Au-Yeung

Web developer specializing in React, Vue, and front end development.

Leave a Reply

Your email address will not be published. Required fields are marked *