3
As a PO request, using an attribute to copy the Mobile Phone number to the Whatsapp field, displaying a message to the user, as default is OK
and Cancelar
, but I would like the name of the buttons to be Sim
and Não
, How can I change this message?
Note: Everything is working, but as a requirement of the PO the message should be Yes and No.
This is the code used:
$('#Whatsapp').focus(function () {
var celular = $('#Celular').val();
var whatsapp = $(Whatsapp).val();
celular = celular.replace(/[\-_()]/g, "");//Remove special characters
whatsapp = whatsapp.replace(/[\-_()]/g, "");//Remove special characters
if (celular.length == 11) {
if (whatsapp.length != 11) {
if (confirm("O numero do celular também é o número do Whatsapp?") == true) {
$('#Whatsapp').val($('#Celular').val());
} else {
$('#Whatsapp').val('');
}
}
}
});
Edited down from here
I tried to use this way too, but did not succeed (Dialog nor opened):
$('#Whatsapp').focus(function () {
var celular = $('#Celular').val();
var whatsapp = $(Whatsapp).val();
celular = celular.replace(/[\-_()]/g, "");//Remove special characters
whatsapp = whatsapp.replace(/[\-_()]/g, "");//Remove special characters
if (celular.length == 11) {
if (whatsapp.length != 11) {
var mensagem = "O numero do celular também é o número do Whatsapp?";
mensagem.dialog({
modal: true,
buttons: {
"Sim": function () {
$('#Whatsapp').val($('#Celular').val());
$(this).dialog('close');
},
"Não": function () {
return false;
$('#Whatsapp').val('');
$(this).dialog('close');
}
}
});
//if (confirm() == true) {
// $('#Whatsapp').val($('#Celular').val());
//} else {
// $('#Whatsapp').val('');
//}
}
}
});
Related: http://answall.com/questions/10759/como-mudaro-texto-do-bot%C3%A3o-ok-do-Alert
– novic
@Virgilionovic edited the question, give a look if you can
– Fabio Souza
Also insert the html from your dialog
– MarceloBoni
check in the browser console tab if there is no Javascript error
– Thiago Custodio
This
confirm
browser native cannot be customized. You can user a librarythird-party
as Sweetalert (my favorite). Or, if you don’t want to warm your head with this, change the message to "Click OK to confirm if cell phone number is also the Whatsapp number.".– mrlew