Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
  
  
  
<script src="//code.jquery.com/jquery-2.1.1.min.js"></script>
  <meta charset="utf-8">
  <title>JS Bin</title>
</head>
<body>
  <h1>Stack overflow test</h1>
  <a id="link" href="http://google.com">A link</a>
</body>
</html>
 
     var $element = $('#link');
    
     var url = $element.attr('href');
     var windowObjRef;
    
    $element.on('click', function () {
      
      window.setTimeout(function(){
        windowObjRef = window.open(url);
        console.log(windowObjRef);
      }, 2000);
      
      
      
    });
    
Output 300px

This bin was created anonymously and its free preview time has expired (learn why). — Get a free unrestricted account

Dismiss x
public
Bin info
anonymouspro
0viewers