0

I have the following code:

<li>
    <a class="button accessLink"
    data-disabled="no"
    data-href="/MyAccount/Access/Logout"
    title="Logout"><span class="smaller">LOGOUT</span></a>
</li>

I specified data-disabled as "no" but is it possible to use the values true / false ?

2 Answers 2

5

No, HTML5 data-* attributes' values are strings.

You can of course use the strings "true" and "false".

Sign up to request clarification or add additional context in comments.

Comments

0

Yes, you can, in HTML5, unless you use XHTML serialization (in which case normal XML rules apply).

In HTML serialization of HTML5, the attribute syntax allows the use of the attribute name alone, in which case the implied value is the empty string. When using data- attributes in scripting (or styling), you can then use constructs that test for the presence of the attribute.

You can check out that http://validator.nu/ accepts an element like <a data-disabled>foo</a>.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.