What are all the valid DIV
attributes?
Based on this link, it appears only class
, id
, title
. Is that correct? Meaning, the for
attribute and others is not valid for DIV
?
What are all the valid DIV
attributes?
Based on this link, it appears only class
, id
, title
. Is that correct? Meaning, the for
attribute and others is not valid for DIV
?
A list of attributes is available here: https://www.w3schools.com/tags/tag_div.asp
Plus all the event attributes:
With HTML5, besides using the global attributes which can be used on any element, you can also define your own attributes using the
data-
attributes.John Resig on
data-
attributesAll you have to do is use the HTML5 doctype (
<!DOCTYPE html>
) and your page will be valid. This doctype works fine even in older browsers.contenteditable attribute also helpful and rarely used.
This attribute is provide a way to use this like a Normal textbox. but text changed on browser side is not saved in coding.
FIDDLE
See W3C specs:
for
is forlabel
and specifies theid
attribute of the input element to which the label applies.See also the HTML5 specs: