Bren Bren - 1 year ago 1089
Javascript Question

How to use Jquery how to change the aria-expanded="false" part of a dom element (Bootstrap)?

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?


Answer Source

You can use .attr() as a part of however you plan to toggle it:

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download