I have the following element:
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
I want to use jquery (or just javascript would work) to alter the aria-expanded field to toggle it between true and false.
How would I go about this?
Thanks!
You can use .attr() as a part of however you plan to toggle it:
$("button").attr("aria-expanded","true");
2.1m questions
2.1m answers
60 comments
57.0k users