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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T12:57:09+00:00 2026-06-05T12:57:09+00:00

I am going to have a list of select fields, collecting the same type

  • 0

I am going to have a list of select fields, collecting the same type of data. For example, I’ll have a few select lists, tagged to the same class.

<select name="NBSCourse1" class="NBSCourse"></select>
<select name="NBSCourse2" class="NBSCourse"></select>
<select name="NBSCourse3" class="NBSCourse"></select>
// and so on... 

I’ve written a method to detect change in the select lists, all referring to them by class.

$("select.NBSCourse").change(function() {
 //Other codes here

})

It seems that the first select list (name=”NBSCourse1″) works, but the other select lists do not work. Am I not supposed to use classes for select lists, if there are multiple similar ones?


Details on what I’m trying to do…

Actually, the first row of Select Fields has been initialized by a jQuery function I’ve wrote: addrow(n). The method is called during, on $(document).ready.

I also have a button “Add More”, which will call the addrow(n) function. I’ve declared a counter that’s called ‘counterNBSCourse’, which I passed into the function. addrow(counterNBSCourse).

function addRow(n){         
var tablerow 
tablerow = "<tr>";
tablerow += "<td><select name='NBSCourse" + n + "' class='NBSCourse'></select></td>";
    //Other select fields

   tablerow += "</tr>"


    $("table.courses").append(tablerow);

//Method to populate select list
    $.ajax({url:"dropdown.asp?type=courseidfill", success:function(result) { 
     $("select[name=NBSCourse" + n + "]").html(result);

}})

        counterNBSCourse++

    }

As you can see, when I add another row of select fields that has a class “NBSCourse”, my is name according to the current value of “counterNBSCourse”. “NBSCourse1″,”NBSCourse2”.. etc.

At the moment, only responds to the field.

Further notes of the $(“select.NBSCourse”).change(function() {

$("select.NBSCourse").change(function () {

    //Getting select field's name       
var name
name = $(this).attr('name');

    //Getting the number tagged behind the select name file     
var num     
num = name.replace("NBSCourse","");

//Getting selected value
    var nbsCourseid;
nbsCourseid = $(this).val();

//Function to populate another select field,        
$.ajax({url:"dropdown.asp?value="+ nbsCourseid + "&type=courseid",success:function(result) { 

 $("select[name=IndexNo" + num + "]").html(result);                 
}})     
})
  • 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-05T12:57:11+00:00Added an answer on June 5, 2026 at 12:57 pm

    It’s ok to use class selector, you miss a " of your code $("select.NBSCourse).

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

Sidebar

Related Questions

I have a dropdown list in which I select how many people are going
I have a list of Object arrays (List) That I am going to pass
I have a list of variables: variables = ['VariableA', 'VariableB','VariableC'] which I'm going to
if have the following problem: I have a List which i am going through
I have a website that in a few months is going to have traffic
I'm trying to get a list going. I have an empty input box in
I have this form with a select list box in it. It shows a
I am going to have a fixed list of items to order by that
I have a database which is going to have UMT timestamps in standard sql
What I have going on is a listview inside of my windows form. How

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.