Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script class="jsbin" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
    <script>
        function doClick(event, myA)
        {
            if (myA.click)
            { 
                myA.click()
            }
            else 
              if (document.createEvent)
            {
                if (event.target !== myA)
                { 
                    var tmpEvent = document.createEvent("MouseEvents");
                    tmpEvent.initMouseEvent("click", true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
                    var allowDefault = myA.dispatchEvent(tmpEvent);
                }
            }
        }
      
      
      $(document).ready(function(){
                        
            $(".myBtn").on('click',function (event) 
                           { doClick(event, $("#link")[0]);    });
      });
     
       
      
    </script>
</head>
<body>
    <a id="link" href="http://www.msdn.com">Normal link</a>
    <button type="button" class="myBtn"   >
        do click</button>
    <br />
    <br />
</body>
</html>
Output

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

Dismiss x
public
Bin info
anonymouspro
0viewers