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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T18:08:12+00:00 2026-05-22T18:08:12+00:00

I have a requirement of changing all dropdown values in all the rows in

  • 0

I have a requirement of changing all dropdown values in all the rows in a tale based on master dropdown. say someone selects “value 2” in dropdown1, dropdown2 values in all the rows in the table should show “value2”.

    function change(){

var cid = document.frm.locdropdown.selectedIndex;

document.frm.locdropdown2.selectedIndex = cid;


}

is the java script I use to change it but this changes only first row.

please help..

  • 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-22T18:08:13+00:00Added an answer on May 22, 2026 at 6:08 pm

    From your example code it looks like you’ve given the same ID to all your locdropdown2 elements? Maybe you should post an example of your table HTML. It’s normal practice to give unique IDs to elements, so you may want to test the NAME attribute instead, but anyway something like the following should work:

    function change() {
       var cid = document.frm.locdropdown.selectedIndex;
       var inputs = document.getElementsByTagName("input");
       for (var i=0, l = inputs.length; i < l; i++) {
          if (inputs[i].id == "locdropdown2")
             inputs[i].selectedIndex = cid;
       }
    }
    

    Another option is to loop through each row in the table. The following example assumes your locdropdown2 inputs are the only thing in the third column, but you can adapt to suit your actual layout:

    function change() {
       var cid = document.frm.locdropdown.selectedIndex;
    
       var tableRows = document.getElementById("yourTableId").tBodies[0].rows;
       for (var i=0, l=tableRows.length; i < l; i++) {
          tableRows[i].cells[2].firstChild.selectedIndex = cid;
       }
    }
    

    Note: I haven’t actually tested any of that code, but it should be more than enough to get you started and you can tweak as needed. (You can use Google to learn about tBodies, rows, cells, firstChild, etc.)

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

Sidebar

Related Questions

I have requirement as following like showing ABPeoplePickerNavigationController in tabbar based application. I researched
I have a requirement to store all versions of an entity in a easily
We have a business requirement to show a cost summary for all our projects
I have a java based web application(struts 1.2). I have a requirement to display
I have requirement like this, Have One NSIMageView and which will be changing frequently
I have requirement of specifying web part connections in onet.xml. So when site is
I have requirement like, suppose I have a 'property' table which has 'ListingKey' field
I have requirement to get Facebook friends list with their images. How can I
In our project we have requirement that, after receiving sms message from third party
I have a requirement where I ask user for confirmation and also display messages.

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.