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

205
Vistas
How to verify Google Earth Link within a form using Regex

I am trying to validate that the link that I am entering into a form is a valid Google Earth link however, its accepting all link apart from google earth link; here is the code for my js script that I am trying to do this with.

 validate: function() {
        var inputFields = $('input[type=text]');
        var notAvailable = $('#op_not_available');
        var GoogleEarthUrl = $('#op_gooogle_earth_link').val().trim();
        var twitterUrl = $('#op_twitter_url').val().trim();
        var urlRegex = /^(ht|f)tps?:\/\/[a-z0-9-\.]+\.[a-z]{2,4}\/?([^\s<>\#%"\,\{\}\\|\\\^\[\]`]+)?$/;
        var GoogleEarthRegex = /google.com/;
        var twitterRegex = /twitter.com/;
        if (!notAvailable.prop("checked")) {
          $("#not_available").val('off');
          for (var i = 0; i < inputFields.length; i++) {
            if (!$(inputFields[i]).val().trim().length) {
              return 'Please enter all fields';
            }
          }
          if ((GoogleEarthUrl !== '-') && !(urlRegex.test(GoogleEarthUrl) && GoogleEarthRegex.test(GoogleEarthUrl))) {
            return 'Please enter a valid Google Earth URL';
          }
          if ((twitterUrl !== '-') && !(urlRegex.test(twitterUrl) && twitterRegex.test(twitterUrl))) {
            return 'Please enter a valid Twitter Url';
          }
        }else{
          $("#not_available").val('on');
        }
        return;
      }
    };
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