Javascript customize confirm, replace "ok" and "cancel" button text, execute function only if ok clicked


How can I customize the confirm , replacing the Ok and Cancel button text? I also wanted to run the function only if I click Ok.

Follow the code below without success

 <script> function funcao_a() { confirm('funcao A'); } function funcao_b() { alert('funcao B'); } </script> <button id="btn" onclick="confirm('Confirmar?',funcao_b());">Clique aqui</button>



With the native function you can't create custom checkboxes , you can however use jquery UI to simulate this:

function funcao_b() {
  alert('funcao B');
function confirmar() {
    $( "#dialog-confirm" ).dialog({
      resizable: false,
      height: "auto",
      width: 400,
      modal: true,
      buttons: {
        "Yap executa função b": function() {
          $( this ).dialog( "close" );
        'Não executa nada': function() {
          $( this ).dialog( "close" );
  <link href="//">
<script src=""></script>
<script src=""></script>

<button id="btn" onclick="confirmar();">Clica</button>
<div id="dialog-confirm" title="Executar função?"></div>
Scroll to Top