2
How to remove or disable the (cancel) button from the javascript prompt function?
2
How to remove or disable the (cancel) button from the javascript prompt function?
2
Good afternoon friends!
It is not yet possible to change the dialogs generated through the window follow HTML spec
Trying to solve your problem you can use some lib to generate dialogs through the DOM.
1
Currently it is not possible to disable the button, but a solution could be to force the person to write 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 that case, if the person cancels or declines, it will open another prompt (just like if responding blank).
Browser other questions tagged javascript
You are not signed in. Login or sign up in order to post.
yes, use a
alert()
– Leandro Angelo
Take a look at this soe’s link
– Alvaro Alves
another alternative is to use libraries of the type bootbox
– Alvaro Alves