Code of how I'm doing below:
function verificaValorComValorOriginal () {
debugger;
// Dados Básicos
if ($('#nomePessoa').val() != null && $('#nomePessoaOriginal').val() != null) {
if ($('#nomePessoa').val() != $('#nomePessoaOriginal').val()) {
$('#nomePessoa').attr("style","background: yellow;");
$('#nomePessoaOriginal').attr("style","background: yellow;");
}
}
if ($('#apelido').val() != null && $('#apelidoOriginal').val() != null) {
if ($('#apelido').val()!= $('#apelidoOriginal').val()) {
$('#apelido').attr("style","background: yellow;");
$('#apelidoOriginal').attr("style","background: yellow;");
}
}
if ($('#sexo').val() != null && $('#sexoOriginal').val() != null) {
if ($('#sexo').val() != $('#sexoOriginal').val()) {
$('#sexo').attr("style","background: yellow;");
$('#sexoOriginal').attr("style","background: yellow;");
}
}
if ($('#dataNascimento').val() != null && $('#dataNascimentoOriginal').val() != null) {
if ($('#dataNascimento').val() != $('#dataNascimentoOriginal').val()) {
$('#dataNascimento').attr("style","background: yellow;");
$('#dataNascimentoOriginal').attr("style","background: yellow;");
}
}
if ($('#estadoCivil').val() != null && $('#estadoCivilOriginal').val() != null) {
if ($('#estadoCivil').val() != $('#estadoCivilOriginal').val()) {
$('#estadoCivil').attr("style","background: yellow;");
$('#estadoCivilOriginal').attr("style","background: yellow;");
}
}
This is a small example of the code, for example this CivilCode is a DropList and does not work when the value is different. I'm using PrimeFaces 6.2.
Solution:
if ($('#estadoCivil').val() != null && $('#estadoCivilOriginal').val() != null) {
if ($('#estadoCivil').val() != $('#estadoCivilOriginal').val()) {
$(".pui-dropdown-label").each(function() {
if ($(this).context.parentElement.innerHTML.indexOf('estadoCivil') > 0) {
$(this).attr("style","background: yellow;");
}
});
}
}
For the time being I got the above solution.