I wanna add a custom button (Send Mail) on contact detail page, And is email field is having an email then on click he ask with a popup "Wanna send a mail ?" And wanna add 'Yes' Or 'No' instead off 'Ok' and 'Cancel' .

enter image description here

2 Answers 2


There is no exact and simple solution for this OK and CANCEL in Confirm Popup using javascript. But you can do this with the help of JQUERY. Try the below link to understand better...



Open jQuery Dialog from Custom Button


Hope this helps...

  • ,OK! But can we use jQuery onclick of button that is add to detail page of any contact's record.,????
    – AkshAy
    Commented May 12, 2016 at 6:59
  • I think you can...Just see my updated Links for that....
    – Subhash
    Commented May 12, 2016 at 7:07
  • Thnks a lot Subhash :)
    – AkshAy
    Commented May 12, 2016 at 7:16

onclick="return confirm('Wanna send a mail?');"

If you return a false onclick the method will not be called. The confirm function returns true or false (OK or Cancel).


Display Type : Detail Page Button

Behavior : Execute Javascript

Content Source : Onclick Javascript

and in the text box copy the below JS code ,

    var x;
    if (confirm("Wanna send a mail!") == true) {
        x = "YES";
    } else {
        x = "NO";
    if(x == 'NO'){ 

else { 
window.location.replace('/apex/AccountDetail?id={!Account.Id}') //replace your VF page here
  • It'll show OK and Cancel But i want instead of them Yes and No
    – AkshAy
    Commented May 12, 2016 at 7:00

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .