PHP and Javascript - Yes and No options in Confirm popup

Asked

Viewed 519 times

1

On my website, I have an event query section. Within this section, I added a CANCEL EVENT button. When this button is clicked, it executes the following javascript function:

function cancelaEvento(val){
    var valor = val;
    if (confirm("Tem certeza que deseja cancelar o evento "+val+"?\nCaso deseje fazer alguma alteração, clique em Editar") == true) {
        location.href = "http://meusite.com.br/consultaeventos/cancelar?valor="+valor;
    }
}

But I wanted in the popup of confirm appeared YES and NO or instead of OK and CANCEL. How can I do this?

  • 1

    The standard dialog box cannot be customized in normal ways. It is always OK and CANCEL. Search by "javascript custom confirm" on google for alternative solutions.

  • 1

    Exactly, an alternative is to use Jquery dialogs: http://jqueryui.com/dialog/#modal-confirmation. Or implement the own.

  • It seems that natively it is not possible, but a library can be used. http://stackoverflow.com/questions/18420935/javascript-custom-text-on-confirm-ok-cancel-button

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.