Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

147
Vistas
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 la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda