0
I have the following code:
function formataPorcentuaisMensais(){
var cancelamento = $("#cancelamentoMes").text().replace('%','');
var aproveitamento = $("#aproveitamentoMes").text().replace('%','');
var primCompras = $("#primComprasMes").text().replace('%','');
var juros = $("#jurosMes").text().replace('%','');
var seguros = $("#segurosMes").text().replace('%','');
if(cancelamento >= 4 && cancelamento <= 6){
cancelamento.css({'background-color': 'yellow', 'color': 'black'});
}
}
$(function(){
formataPorcentuaisMensais();
});
Apparently correct but says the function cancelamento.css
is not a function, someone knows what can be?
*I have jquery loaded; **All variables are working.
Thank you!
thank you very much, it worked perfectly. I just didn’t understand how the function . css doesn’t handle string but it worked just by calling Elemental with id #cancel
– João Vitor
The css function does not belong to the strings, you cannot change the css of a string, because a string does not have CSS, it is just text. You can change the CSS of an HTML element, such as a div. In this case, the #cancel Mes element. To catch this element you use $("#cancellations"). Understand?
– André
Perfectly @André, grateful!
– João Vitor