I have this slideToggle code. When I click the button that says "open", it changes the text to "close". It stays as "close"d even if you click it again so I want to change the text back to "open" when I click on "close" and vice versa.
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
$("#flip").click(function(){
$("#panel").slideToggle("slow");
$('#flip').html("close");
reset ();
});
});
</script>
<style>
#panel,#flip
{
padding:5px;
text-align:center;
background-color:#e5eecc;
border:solid 1px #c3c3c3;
}
#panel
{
padding:50px;
display:none;
}
</style>
</head>
<body>
<div id="flip">open</div>
<div id="panel">Hello world!</div>