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

137
Views
Define Value range in element using startsWith() - jQuery

I need to know if there is a shorter way to simplify below line of code indicating possible values of an element that starts with a defined 3 digit numbers.

$('#nf-field-168').val().startsWith("010" | "011" | "012" | "013" | "014" | "015");

if there's a way to define them as range (ex. 010 - 015) rather than using the vertical bar Operator? Is such method exist?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Try using match() and regex

$('#nf-field-168').val().match(/^01[0-5]/) // returns null if not matched

https://regex101.com/r/F8VnaZ/1

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!