How about I need to get the value of the dom elements as soon as they lose focus. I have a form created with javascript so I use the onClick to capture the Id of the clicked element to later put it in the blur function, like this:
var idRespuesta;
$(function() {
$('body').on('click','.respuestas',function(){
idRespuesta = $(this).attr('id');
})
})
After that I wait for the focus to be lost
$(function(){
try{
$(idRespuesta).blur(function(){
alert(idRespuesta);
$(this).css("border-color", "#33ff58");
let aux = $(this).val();
alert(aux);
});
}catch(error){
alert(error);
}
})
But I get no response from any of the functions after losing the focus of the element,
I myself answer my question, the blur method did not have a trigger, I solved it by adding the second method within the onclick and adding an auxiliary with
#
the id's own I leave the solution I found