Close current tab by a html button

I want to close the current tab of my program by a button which I created in HTML and gave him a click event so I want to close the tab in js by doing an onclick but when I click on my button nothing happens.

Here is my code:

<div class="modal-footer">
    <button class="btn btn-light" id="closebtn" onclick="closeBtnClicked"> Close </button>
    <button class="btn btn-primary">Save</button>
</div>

And this is my js function:

function closeBtnClicked(){
    window.close();
}

70 thoughts on “Close current tab by a html button”

  1. Howdy would you mind stating which blog platform you’re working with?
    I’m looking to start my own blog soon but I’m having a difficult time deciding between BlogEngine/Wordpress/B2evolution and Drupal.
    The reason I ask is because your design and style seems different then most blogs
    and I’m looking for something completely unique.
    P.S My apologies for being off-topic but I had to ask!

    Reply
  2. Wow, awesome weblog structure! How lengthy have you ever been running a blog for? you make running a blog look easy. The overall glance of your web site is fantastic, as well as the content! similar

    Reply
  3. I’m not that much of a internet reader to be honest but your sites really nice, keep it up!
    I’ll go ahead and bookmark your website to come back in the future.
    Many thanks

    Reply
  4. Hello there, I found your website via Google even as
    looking for a comparable topic, your site came
    up, it seems to be great. I have bookmarked it in my google bookmarks.

    Hi there, just became aware of your weblog via Google, and found that it is really informative.
    I am gonna be careful for brussels. I will be grateful if you happen to continue this in future.
    Lots of other folks will likely be benefited from your writing.
    Cheers!

    Reply
  5. You actually make it appear so easy with your presentation but I to find this matter to be actually one thing which I believe I would never understand. It kind of feels too complex and extremely broad for me. I’m looking ahead to your next submit, I will attempt to get the cling of it!

    Reply
  6. Today, I went to the beachfront with my kids. I found a sea
    shell and gave it to my 4 year old daughter and said “You can hear the ocean if you put this to your ear.” She put the shell to her ear and screamed.
    There was a hermit crab inside and it pinched her
    ear. She never wants to go back! LoL I know this is entirely off topic but I had to tell someone!
    scoliosis surgery https://coub.com/stories/962966-scoliosis-surgery scoliosis surgery

    Reply

Leave a Comment