I have data attribute in html element as <button data-verified=false>Update</button>
. It have boolean value for data attribute.
Is there any difference with following element <button data-verified="false">Update</button>
as the data-attribute is wrapped with double quotes.
Is boolean values are supported in html?
Boolean attributes are supported in HTML, but data-verified isn't one of them, no matter how it appears in the markup. data-verified=false
and data-verified="false"
both create an attribute of the type string and value "false", which if tested in JS as a boolean will be treated as true
This is only the case because false
doesn't contain spaces. As a contrary example, data-verified=not true
is invalid and not at all the same as data-verified="not true"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With