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?
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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.