Draggable attribute is used to
pull i.e. drag a portion of text in a web page.
It is also used to restrict the viewers from copying the contents of a site.
<input draggable="true/false/inherit">
Values added with this attribute are:
Value
Description
true
Text can be dragged.
false
Text cannot be dragged.
inherit
The text can be dragged if the main element can be dragged.
Example Code 1:
Result :
Try to drag this text
Example Code 2:
Result :
Try to drag this text
Example Code 3:
Result :
Try to drag this text.
Example Code 1 (Explanation):
You can drag the text.
Example Code 2 (Explanation):
You will be restricted from dragging the text.
Example Code 3 (Explanation):
Text can be dragged if the main input is mentioned with value "True".
It is supported by most of the elements in HTML5 & it is not available in the previous versions of the HTML.
Limitations:
It is applicable only in Firefox, Chrome and Safari browsers. In Firefox, use this attribute with "ondragstart" mouse event in order to enable dragging option.