Which attribute value enables dragging on an element in HTML5?

Prepare for the Web Design EOPA Test. Study with interactive quizzes and multiple-choice questions, complete with hints and detailed explanations. Get ready for your web design certification!

Multiple Choice

Which attribute value enables dragging on an element in HTML5?

Explanation:
Draggable is a boolean HTML5 attribute that marks an element as draggable using the HTML5 drag-and-drop API. To enable dragging, the attribute is present with a value of true, for clarity in the markup: draggable="true". You can also simply write draggable, and it will be treated as enabled because the attribute is present. This is why draggable="true" is the best choice among the options: it explicitly communicates that dragging is allowed and aligns with how boolean attributes are commonly written in HTML. The other values aren’t appropriate: draggable="on" isn’t the standard value for this attribute, draggable="false" doesn’t reliably disable dragging in all browsers since the presence of the attribute can still enable dragging, and draggable="enable" isn’t a recognized value for this attribute. When dragging is enabled, you typically handle events like dragstart to set up the drag data.

Draggable is a boolean HTML5 attribute that marks an element as draggable using the HTML5 drag-and-drop API. To enable dragging, the attribute is present with a value of true, for clarity in the markup: draggable="true". You can also simply write draggable, and it will be treated as enabled because the attribute is present.

This is why draggable="true" is the best choice among the options: it explicitly communicates that dragging is allowed and aligns with how boolean attributes are commonly written in HTML. The other values aren’t appropriate: draggable="on" isn’t the standard value for this attribute, draggable="false" doesn’t reliably disable dragging in all browsers since the presence of the attribute can still enable dragging, and draggable="enable" isn’t a recognized value for this attribute. When dragging is enabled, you typically handle events like dragstart to set up the drag data.

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy