I have a code for a dropdown function that is working smoothly. Now I would like the comment box to show permanently when clicked and close when clicked outside of it.
Currently, when I click on the comment, the box shows up but if I try to input a comment by dragging my mouse, the box closes. How can I make sure the box stays open?
.dropdown {
position:relative;
}
.dropdown-menu {
position:absolute;
top:100%;
left:0;
z-index:1000;
display:none;
float:left;
min-width:300px;
list-style:none;
background-color:#fff;
border:1px solid rgba(0,0,0,0.2);
border-right-width:2px;
border-bottom-width:2px;
-webkit-border-radius:5px;
-moz-border-radius:5px;
border-radius:5px;
-webkit-box-shadow:0 5px 10px rgba(0,0,0,0.2);
-moz-box-shadow:0 5px 10px rgba(0,0,0,0.2);
box-shadow:0 5px 10px rgba(0,0,0,0.2);
-webkit-background-clip:padding-box;
-moz-background-clip:padding;
background-clip:padding-box;
margin:1px 0 0;
padding:4px 0;
.navbar .dropdown-menu:after {
position:absolute;
top:-6px;
left:10px;
display:inline-block;
border-right:6px solid transparent;
border-bottom:6px solid #fff;
border-left:6px solid transparent;
content:'';
.open .dropdown-menu {
display:block;
}
<span class="navbar">
<span class="dropdown">
<a data-toggle="dropdown" class="comment" href="#">Comment</a>
<ul class="dropdown-menu">
<li><input type="text"></li>
</ul>
</span>
</span>