Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

152
Views
Close Tab not working properly using jquery

I am working on MCV core with the Dapper project. On one of my pages, I have a Grid that contains records and ACTION,

No Name Address Mobile UPDATE VIEW

1 XYZ XYZ 123 UPDATE VIEW

2 XYZ XYZ 456 UPDATE VIEW

When I click on the UPDATE Link from a specific row I am opening my new PAGE updareUserRecord.cshtml IN NEW TAB.

When I click on UPDATE BUTTON after updating the record in updareUserRecord.cshtml, record gets updated. On the SAME page, I have CLOSE BUTTON. I want to close the updareUserRecord.cshtml. Only.

Using Jquery and Javascript I have tried but some times below code work sometimes not. Can Anyone give me the perfect solution?

Like no matter, I want to close the PAGE.

This is the code I have tried.

@*<button type="button" class="btn btn-primary" id="btnClose" onclick="javascript:window.open('','_self').close();">Close</button>*@                
<button type="button" class="btn btn-primary" id="btnClose"  onclick="window.top.close();">Close</button>
<button type="button" class="btn btn-primary" id="btnClose"  onclick="window.close();">Close</button>
about 4 years ago · Santiago Trujillo
1 answers
Answer question

0

You can add simply click function using jQuery

$('#btnClose').click(function () {
  window.close(); //through writing this statement working also in browser 
  console
});

I think helps this solution Thank you :)
about 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!