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 8737573
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T10:33:19+00:00 2026-06-13T10:33:19+00:00

I´m trying to compare values from an array with values in a combobox in

  • 0

I´m trying to compare values from an array with values in a combobox in jquery but with no success.

I have an array this way: (value 1,value 2,…) names separated with , (Example: john smith,peter pan,). On the other hand a combobox with values from a localstorage appended dynamically this way

 $('select[name="selectListMenu1"]').append( new Option(nombre.fname + " " + nombre.lname) );

This gives me a final name like ‘John smith’ and I append it to the combo.

Now I want to compare each name in the array with each name in the combobox and get selected in the combobox the names that matches.

var summary3 = (elnombre.proycontac).split(","); // split the names to compare
var p1 = summary3.length                         // get the number of names to compare
$('[name="selectListMenu1"] ').each(function(){           //from here i get lost 
       for (a=0; a<=p1-2; a++) { 
              if ($(this).text())=== summary3[a] {
              // select the name in combobox
              }
       }
}); 
  • 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-13T10:33:20+00:00Added an answer on June 13, 2026 at 10:33 am

    You could try this:

    $.map(summary3, function(elem, i) {
      $('select[name="selectListMenu1"] option[text="' + elem + '"]').attr('selected', true);
    });
    

    I put an example here.

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

Sidebar

Related Questions

I am trying to compare 2 values from 2 arrays, 1 array is from
I'm trying to figure out how I can compare values from an array against
I'm trying to compare a couple of array values stored in a flat file
i am trying this code for make a validation for a value. (regex from
I'm trying to use simpletest to compare two numeric strings, one from an array
I'm trying to compare two millisecond values in Java. One from a calendar, and
I am looking for a way to extract/get values from an array and assign
I'm trying to compare the value of some data from an ajax request (json)
I'm trying this code for entering values into multidimensional char array in C. The
I am trying to compare values on data frame rows, and removing all the

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.