Is there any way in JavaScript or jQuery to include a Id
in a div
within a condition?
In my code I'll exemplify:
$('#TxtDesc').on('input', function(){
var value = $(this).val();
var progressValue = $('#progressText div');
var color, percent = 0;
if(value.length <= 100){
color = "red";
percent = 15;
}else if(value.length <= 199){
color = "yellow";
percent = 50;
}else{
color = "#32CD32";
percent = 100;
/* Gostaria que nessa condição fosse adicionado um id
para a div onde o script roda */
}
var Valor = value.length;
progress(percent, $('#progressText'), 300);
progressValue.css("background", color);
$('#progressText').css("border", "1px solid " + color);
});
Is there any way to do this?