user31782
user31782

Reputation: 7589

Should aria-expanded attribute take the value true or string "true"?

I am setting the aria-expanded attribute's value with jquery. I am confused whether I should do:

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

or

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

Should true be treated as a string or simply a javascript data type?

Upvotes: 1

Views: 723

Answers (1)

Bharatsing Parmar
Bharatsing Parmar

Reputation: 2455

We can use both way to set aria-expanded attribute. Both will set attribute correctly.

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

Normally first option is used but we can use both.

Upvotes: 1

Related Questions