Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

199
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!