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

201
Visualizações
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 à 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