aria-expanded属性应该取值true或string" true"?

时间:2017-02-25 07:52:38

标签: javascript jquery html html5 wai-aria

我使用jquery设置aria-expanded属性的值。我是否应该这样做很困惑:

$(".dropdown-toggle").attr("aria-expanded", true);

$(".dropdown-toggle").attr("aria-expanded", "true");

是真的应该被视为字符串还是简单的javascript数据类型?

1 个答案:

答案 0 :(得分:1)

我们可以使用两种方式设置 aria-expanded 属性。两者都将正确设置属性。

$(".dropdown-toggle").attr("aria-expanded", "true");
$(".dropdown-toggle").attr("aria-expanded", true);

通常使用第一个选项但我们可以同时使用它们。

相关问题