Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
<script src="https://code.jquery.com/jquery-2.1.4.js"></script>
  <meta charset="utf-8">
  <title>JS Bin</title>
</head>
<body>
<a class="link_1">My Link1</a>
<a class="link_2">My Link2</a>
<a class="link_3">My Link3</a>
</body>
</html>
 
  $(document).ready(function () {
            $('body').on('click', 'a.disabled', function (event) {
                event.preventDefault();
            });
            jQuery.fn.extend({
                disable: function (state) {
                    return this.each(function () {
                        var $this = $(this);
                        if ($this.is('input, button'))
                            this.disabled = state;
                        else
                            $this.toggleClass('disabled', state);
                    });
                }
            });
            // Disabled on all:
            $('input, button, a').disable(true);
            // Enabled on all:
            $('input, button, a').disable(false);
            $('.link_1').click(function () {
                alert('link_1 clicked');
            });
            $('.link_2').click(function () {
                alert('link_2 clicked');
            });
    
              $('.link_3').click(function () {
                alert('link_3 clicked');
            });
        }); 
Output

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
plkilroypro
0viewers