Remove Button in function of javascript [closed]

2

Is there a way to remove or disable the (cancel) button of the javascript prompt?

    
asked by anonymous 16.10.2018 / 19:14

2 answers

1

At the moment it is not possible to disable the button, but a solution could be to force the person to write by opening another prompt when the initial is canceled:

function noRefuse() {
  do {
    x = prompt("Responda minha pergunta!")
  } while(!x)
}

var botao = document.getElementById('prompt')

botao.addEventListener('click', noRefuse);
<input type='button' id='prompt' value='Prompt'>

In this case, if the person cancels or declines, it will open another prompt (just like if they respond in blank).

    
16.10.2018 / 21:14
2

Good afternoon, friends!

It is still not possible to change dialogs generated through the window follows Html spec

Trying to solve your problem you can use some lib to generate dialogs through the DOM.

    
16.10.2018 / 20:27