Learn free online HTML5, javascript, and jquery Tutorials by Examples

Friday, 16 December 2016

How to disable trigger click after first click


















NOTE: Multiple clicks on <a> tag, trigger fires only one time.
 
<a class="active">One</a>
<a class="active">Two</a>
<a class="active">Three</a>

<div id="count"></div>


<script>
       $('a.active').one('click', function() {
            $('#count').trigger('click');
       });

      $('#count').click(function() {
         console.log('I Was Clicked Once!');
      });
</script>

No comments:

Post a Comment