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

136
Views
If a certain range value is entered, display a message using javascript

I'm trying to display a Javascript error message if a certain range value is entered in a field. example: If the version entered is between 13.0.x to 13.8.5, an error message will be displayed. I'm trying the code below but it's not working. Any help would be greatly appreciated. Thank you

$('#custom_fields_1234').on('blur', function() {
      $('.errorMessage').remove();
      if ($(this).val().split('.')[0] < val => 13.0.0 && =< 13.8.5) {
        $('.custom_fields_1234').append(errorMessage());
      }
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You can split the version number to check, for example.

function isVersionInRange( version, maxVersion, minVersion ) {
  const [major, minor, patch] = version.split('.').map(Number)
  const [maxMajor, maxMinor, maxPatch] = maxVersion.split('.').map(Number)
  const [minMajor, minMinor, minPatch] = minVersion.split('.').map(Number)

  // if the version is greater than the maxVersion
  if (
    major > maxMajor ||
    (major === maxMajor && minor > maxMinor) ||
    (major === maxMajor && minor === maxMinor && patch > maxPatch)
  ) {
    return false
  }

  // if the version is less than the minVersion
  if (
    major < minMajor ||
    (major === minMajor && minor < minMinor) ||
    (major === minMajor && minor === minMinor && patch < minPatch)
  ) {
    return false
  }

  return true
}

about 4 years ago · Juan Pablo Isaza Report
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!