My javascript .dropdown-toggle() bootstrap function isn't closing after it has dropped down and I click it again.
I've checked all the other questions on SO (there are a lot), but nothing works.
JS:
<script type="text/javascript">
$(document).ready(function(){
$(".dropdown-toggle").dropdown();
});
</script>
PHP:
<?php
if($_SESSION['admin'] == 1) {
echo "<div class=\"bs-e\">";
echo "<div class=\"dropdown\">";
echo "<a href=\"#\" class=\"dropdown-toggle\">Options <b class=\"c\"></b></a>";
echo "<ul class=\"dropdown-menu\">";
echo "<li><a href=\"pa.php\">P A</a></li>";
echo "<li><a href=\"aED.php\">A T</a></li>";
echo "<li><a href=\"p_a_d.php\">D D</a></li>";
echo "<li class=\"divider\"></li>";
echo "<li><a href=\"logOut.php\">L O</a></li>";
echo "</ul>";
echo "</div>";
echo "</div>";
}
else {
echo "<button value=\"L O\" onclick=\"window.location='lO.php'\" class=\"submit\" style=\"margin-left:420px;margin-bottom:10px;\">Log Out </button>";
}
?>
I want it to go back to its original state when I click the button a second time.