<div id="app">
<button type="button" id="toggle" aria-expanded="false">
Toggle Panel
</button>
<p class="hello">hello</p>
</div>
#app {
margin: 50px;
}
p {
padding: 10px 12px;
border: 1px solid #ccc;
width: 100px;
}
View Compiled
$(function() {
$('#toggle').on('click', function() {
$('.hello').toggle();
$(this).attr('aria-expanded', ($(this).attr('aria-expanded') == "false" ? true : false));
});
});
This Pen doesn't use any external CSS resources.