+ Start a Discussion
ShravanKumarBagamShravanKumarBagam 

How can i close a popup window by onclick event in salesforce

Best Answer chosen by Admin (Salesforce Developers) 
Navatar_DbSupNavatar_DbSup

Hi,

 

If you want to close the pop-up window by clicking on the button present in pop-up window then, you have to write the below code in javascript

<script>

 

function ClosePopup()

   {

       window.parent.close();        

   }

</script>  

<apex:commandButton id="btn" oncomplete="ClosePopup();" value="Submit" />

 

Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved.