Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

146
Visualizações
JQuery - How to check all value from array before goes to else statement?

How can I check all value from array before going to else statement.

My code only working for the first array, in my case which is /members/, but it wont work for rest of the array.

        if ( jQuery( location ).attr( 'href' ) !== 'https://example.com/' ) {
            let getPostType = `<?php echo $post_type = get_post_type($id); ?>`;
            if ( getPostType === 'page' ) {
                let URLsToAvoid = [ '/members/', '/documents/', '/photos/', '/videos/', '/register/', '/agencies/', '/news/', '/events/' ];
                jQuery.each( URLsToAvoid, function( key, value ) {
                    if ( jQuery( location ).attr( 'href' ).includes(value) ) {
                        return false;
                    } else {
                        let displayHeader = `<?php echo do_shortcode( '[elementor-template id="754"]' ); ?>`;
                        jQuery( '.container .site-content-grid > div, .container .bb-elementor-content > div' ).prepend(displayHeader);
                        return false;
                    }
                }); 
            }
        }
about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda