When I click on a button, will it be possible to see a dialog box with the yes or no buttons? If I load the sim to one side if I load it, it will not stay on the page. Is it possible?
When I click on a button, will it be possible to see a dialog box with the yes or no buttons? If I load the sim to one side if I load it, it will not stay on the page. Is it possible?
You can do it the traditional way via javascript. However the options are set to ok or cancel, since confirm
is implemented internally in each browser.
<script>
confirma() {
if (confirm('Deseja realmente fazer determinada ação?')) {
// código caso tenha confirmado
} else {
// código caso tenha cancelado
}
}
</script>
<button onClick="cofirma();"> Botão de confirmação <button>
If it does not suit what you want, since it is something much more specific, I recommend looking for a solution via a plugin, such as Bootstrap modals.
You can use the confirm
function that is native to browsers. It returns true
or false
according to the user response.
if (confirm('Deseja ir para a página de configurações?')) {
window.location.href = 'config.php';
}
It's possible, yes, you can do it this way:
if (confirm('Deseja mudar de pagina?')) {
window.location.href='http://google.com';
} else {
// fica na pagina
}
You can use javascript, you can look at this link , and in that here is an example