jQuery close current window

If you want to close current window programatically, you have to write juse one line code. window.close() method used to close the current window.

window.close();
CODE
<!DOCTYPE html>
<html>
<head>
  <title>target vs currenTtarget in javascript</title>
  <script src="http://code.jquery.com/jquery-1.9.1.js" type="text/javascript"></script>
  <script type="text/javascript">
    $(function () {
      $('.btnClose').click(function () {
        window.close();
      });
    });
  </script>
</head>
<body>
  <button class="btnClose">Close</button>
</body>
</html>
DISPLAY

No comments :

Please Give Your Feedback