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

  • SEARCH
  • Home
  • 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 944123
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T22:32:32+00:00 2026-05-15T22:32:32+00:00

I construct an array, which I am going to use later to compare some

  • 0

I construct an array, which I am going to use later to compare some values.
I use this code to construct “myArray”, which I am going to use later:

var optionTexts = [];  
$('#stripeMeSubSubCat tr').each(function(){

 if ($(this).find('input:checkbox.subsubcat_chkclass:not(:checked)').length == 0)
 {
   subsubrow_cat_id_no = parseInt($(this).closest("tr").attr("id")); 

   optionTexts.push(subsubrow_cat_id_no);
  };   

 });

var myArray = optionTexts.join(', ');
alert("myArray = "+myArray);

Here I use myArray to make a comparison:

$('#stripeMeSubSubCat tr').each(function(){  

     myindex = $.trim($(this).closest("tr").attr("id"));
     var arr = [myArray];

     //var arr = [0, 439, 52, 53];

     myindex = parseInt(myindex);

     alert(myindex);
     alert(arr);

     if ((jQuery.inArray(myindex, arr)) == -1) {
       var equal = "FALSE";
     } else {
       var equal = "TRUE";
     $("#stripeMeSubSubCat tr[id='" + myindex + "'] input").attr('checked', true);
     };

     alert(equal);
 });

As is the code above it always returns FALSE.
However, if don’t use the first chunk of code and just enable the commented out var arr (where I set the array to fixed data) it returns TRUE where it should.

Any ideas?

  • 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-05-15T22:32:33+00:00Added an answer on May 15, 2026 at 10:32 pm

    myArray is a string variable created by concatenating the elements of the optionsText array, not a set of elements. You should be checking optionsText instead of myArray.

    if ((jQuery.inArray(myindex, optionsText)) == -1) {
    

    As an aside, why set the variable equal to the string “FALSE” or “TRUE” — why not simply set it to false or true (the boolean values)?

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

Sidebar

Ask A Question

Stats

  • Questions 499k
  • Answers 499k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer setting a tag would be the easiest way: [myImageView setTag:anIdentifier];… May 16, 2026 at 12:44 pm
  • Editorial Team
    Editorial Team added an answer You can hack the GAE SDK's restrictions of course (you… May 16, 2026 at 12:44 pm
  • Editorial Team
    Editorial Team added an answer Update You are defining Object in a file called object.py.… May 16, 2026 at 12:44 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

Which is better to use in PHP, a 2D array or a class? I've
I have been refactoring throwaway code which I wrote some years ago in a
Currently I'm programming a database class which makes a little bit use of PHP's
I am using Zend_Oauth_Consumer which requires a number of config values to be passed.
Thanks to some very helpful stackOverflow users at Bit twiddling: which bit is set?
I'm trying to load some decimal values from a file but I can't work
When I use new[] to create an array of my classes: int count =
I am going to make a grid of images and I am trying to
This question is slightly different from the kind of finding longest sequence or substring
I'm working on an application for a lab project and I'm making it in

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.