As a PO request, using an attribute to copy the cell number to the whatsapp field, displaying a message to the user, default is OK
and Cancelar
, but I would like the button names to be Sim
and Não
, how can I change this message?
Note: Everything is working, but as a PO requirement the message should be Yes and No.
Thisisthecodeused:
$('#Whatsapp').focus(function(){varcelular=$('#Celular').val();varwhatsapp=$(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 from here down
I tried to use this too, but I did not succeed (Dialog did not open):
$('#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('');
//}
}
}
});