I'm trying to remove a class from a label created dynamically by handlebars,
But I can not find the label with the id of it;
In the console if I pass the idLabel it returns the right id.
"9-hb_usuario-label"
But when I try to do
$('form#hb_form').find(idLabel)
To remove the class it does not.
$('form#hb_form').find('input').each(function () {
console.log(!$(this));
var idLabel = $(this).attr('name') + "-label";
if (idLabel != "undefined-label") {
if ($(this).valid()) {
$('form#hb_form').find(idLabel).removeClass('hide').addClass('hide');
}
else {
$('form#hb_form').find(idLabel.text()).removeClass('hide');
}
}
});