Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9210545
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T01:06:18+00:00 2026-06-18T01:06:18+00:00

I have tried to correct the jQuery code below. In the ESNList text field,

  • 0

I have tried to correct the jQuery code below. In the ESNList text field, multiple values need to be entered separated with a comma, yet they have to be in the same range. For example, in the condition below in the loop, if you input a number in ESNList between 986329 and 999999, the second input in the ESNList field should be in the same range as the first input and so on otherwise I throw an alert saying that both ESNs should be in the same range. I did a loop to perform the check but it’s not working. Can someone demonstrate to me where the error is? A fiddle would help tons, I have a hard time sometimes understanding what people try to say on here without good demonstration of where I went wrong. Below is my code:

<html>
    <head>
    <script type="text/javascript" src="jquery/jquery-1.8.3.js"></script>
    <script type="text/javascript">

    $(function () {


    $(":text").css("border", "2px solid red");
      $(":text").keyup(function(){
        var enteredData = $(this).val()
        console.log(enteredData);
        if (enteredData == "") {
          $(this).css("border", "2px solid red");
        } else {
          $(this).css("border", "inherit");
        }
        if ($(this).attr("id") == "ESNList"){
       esnList = enteredData.split(',');
           }
           
           for(var i = 0; i < esnList.length; i++) {
            if  ( parseInt(esnList[i]) >= 986329 && parseInt(esnList[i]) <= 999999) {
                $("#ddl_StxName").val("stx2");
                $("#ddl_rtumodel").val("globalstar");
                }
            else if ( parseInt(esnList[i]) >= 660000 && parseInt(esnList[i]) <= 699999) {
                $("#ddl_StxName").val("mmt");
                $("#ddl_rtumodel").val("globalstar");
                 }
            else if ( parseInt(esnList[i]) >= 200000 && parseInt(esnList[i]) <= 299999) {
                $("#ddl_StxName").val("stm3");
                $("#ddl_rtumodel").val("stmcomtech");
                 }
            else if ( parseInt(esnList[i]) >= 1202114 && parseInt(esnList[i]) <= 1299999) {
                $("#ddl_StxName").val("smartone");
                $("#ddl_rtumodel").val("globalstar");
          }
          
          else { alert("ESNs should be within the same range"); }
          
        }
        

      });
      });
    </script> </head>
    <body>
    <form id="provision">
        ESNList:    <input  type="text" id="ESNList" name="ESNList" size="30" /> <br />
        ESN Start:<input type="text" id="ESNStart" name="ESNStart" size="10" /> <br />
        ESN End: <input type="text" id="ESNStart" name="ESNStart" size="10" /> <br />
        UnitName:<input type="text" id="STxName" name="STxName" size="30"  />  <br />  
         Unit Model:   <select name="STxName" id="ddl_StxName">
        <option value="stx2">STX2</option>
        <option value="stm3" selected>STM3</option>
        <option value="acutec">Acutec</option>
         <option value="trackpack">Trackpack</option>
        <option value="mmt">MMT</option>
        <option value="smartone">Smartone</option>
        <option value="smartoneb" >SmartOneB</option>
        </select> <br />
        RTU Model Type:
         <select name="rtumodel" id ="ddl_rtumodel">
        <option value="globalstar">GlobalStar</option>
        <option value="both">Both</option>
        <option value="comtech">Comtech</option>
        <option value="stmcomtech">STMComtech</option>
        </select> <br />
        <input type="submit" value ="submit"  />
        </form>
    </body>
    </html> 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T01:06:19+00:00Added an answer on June 18, 2026 at 1:06 am

    try this for debugging:

    before the for(...) line, put

    console.log(esnList.length);
    

    then after the for(...) line:

    console.log("entering for loop, i = " + i );
    

    these will be written to the javascript console, which you can view in the developer tools of most browsers. Include similar logging in your if/else statements, and you can narrow down where the problem is yourself by seeing which of these is triggered.

    You’re on the right track with the alert() you use, just use that or console.log() more often.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the code provided below. I've tried using jquery to select to make
I have a jQuery function I am calling with the below code. The function
I have tried to create a simple controller/model (based on the samples code of
I have the following jquery code: $(document).ready(function() { $(#build_table, a.coursename, .Start Date, .Book Title,
Say I have the following jQuery plugin: $.fn.myPlugin = function () { //plugin code
Hi I have this following code with jquery , so it will alternate colors
I have a piece of jquery code that isn't firing correctly in IE (8
Hi below I have a submit button and a jquery function it performs when
I have tried to highlight the row in a table using jQuery when the
I have the following code: jQuery.post(encodeURI(ajaxurl + '?action=form_submission'), { 'propertyID[]': propArray, submit: 'Export Gallery',

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.