I need that my button close whenever i click javascript

user8427236 Source

enter image description hereI have a button for notification the problem is that it can be closed whenever I click... I need to press again on the button. I try to change the javascript like mouseout or something like this but nothing work.

Django template :

<div class="notification">
      <span class="glyphicon glyphicon-bell"></span>
      {% if unread_notifications_count %}
      <div class="counter">{{unread_notifications_count}}</div>
      {% endif %}
      <ul class="notifications hidden">
        {% for n in notifications %}
          <li class="{% if not n.read %} new {% endif %}">
            <div class="icon"><img src="/static/img/icon-popup.svg"></div>
            <a href="{{n|notification_url}}">
              <div class="date" data-date="{{n.date.ctime}}">{{n.get_date}}</div>
            <div class="clearfix"></div>
        {% endfor %}
        <a href="{% url 'notification_list' %}"><div class="see-all">See all</div></a>


    $('.notification').on('click', function(event){


        position: relative;
        float: left;
        // notification icon
            font-size: 25px;
            padding-top: 6px;
            position: absolute;
            top: 0;
            z-index: 9999;
            right: -5px;
            color: red;
            border-radius: 50%;
            background: $red;
            color: $white;
            width: 17px;
            height: 17px;
            font-size: 12px;
            text-align: center;
            cursor: pointer;


comments powered by Disqus