1
How can I check if the class exists in a variável
jQuery?
jQuery(function($) {
// Captura o atributo para manipulá-lo
var atributo = jQuery(this).parent('.servico').children('.servicos_the_content');
I tried it but it didn’t work:
if($(atributo)).hasClass('active'){
// faz alguma coisa
}
Your condition is wrong, the
if
ends here:if($(atributo))
. Switch toif($(atributo).hasClass('active'))
and be happy :)– Renan Gomes