I have a modal dialog popup that is timed to appear once a week. What I now need to create is a button that closes the modal dialog - I want to hide the top right corner button and replace it with a simple input box button placed within the middle of my modal dialog - any help appreciated.

Other question in regards to creating the popup modal is located here


2 Answers 2


you have {showClose} property which is used in the options for the modal dialog. Make it false. refer & this

For the custom button you have to create it inside your modal HTML & then on click call the modal close.

  • Thanks for this answer Anand - I am reasonable new to JavaScript and eve newer to scripting in the modal HTML. To you have a code example to share with me?
    – garvon-77
    Sep 30, 2015 at 21:51
  • Hi Anand - I did add the showClose to the options of my parent page script block and set it to false. I did need further script to close the window which is set out below. Thanks for your help.
    – garvon-77
    Oct 1, 2015 at 5:45

Ok - I have the code I need. Just a small amount of JavaScript. I have inserted a SEWP on my modal dialog page with the below code to close this window. The link above to my previous code I have a page that onload launches a modal dialog. I wanted to hide the close button and add a new button which would close the dialog.

<script language="javascript" type="text/javascript"> 
function closePopup() {
     return false;
  <div id="confirmBut" style="margin:0;">
     <input onclick="closePopup();" title="Close this message" type="button"
    value="Click here to confirm you accept and understand this message"  
   style="margin: 0; border-radius:5px; width:500px; height:50px; 
    background-color:red; border: 1px grooved grey; font-size:16px; 
    color:white; font-weight:bold; cursor:pointer;">

I know I am able to put the css on the button elsewhere but I have popped it on the item.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.