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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T23:03:59+00:00 2026-06-01T23:03:59+00:00

I have following code to add values in drop down, values are getting added

  • 0

I have following code to add values in drop down, values are getting added but that are not getting displayed in the drop down, i have tested it by reading values after adding in drop down by using jquery fruntions its get red but why should that not displayed in dropdown can you please tell me a solution about that.

1) drop down

  <select id="year" name="year" onchange="test2(this.value)">
    <option value="">Choose Year</option>

2) javascript and jquery code

function getVa2()
    {


     var jSelect=$("select[name='year']");
            jSelect.removeAttr('disabled');

    var lnk =new Array();
    var cnt=0;
    var val=new Array

    $("#data1 a").each(function(index){
    if($(this).attr("class")=="subcategory_link")
    {



    lnk[cnt]=$(this).attr("href");


     cnt=cnt+1;

    }
    });
    cnt=0;
    $("#data1 span").each(function(ind){
    if($(this).attr("class")=="subcategory_name")
    {
      val[cnt]=$(this).text();

      cnt=cnt+1;

    }
    });



    var select1 = document.getElementById("year");

    $("#year").empty();

    select1.options[select1.options.length]=new Option("[ Select Your Series ]","");

        for(i=0; i<lnk.length;i++)
        {

        select1.options[select1.options.length] = new Option(val[i], lnk[i]);
        }

              //This displayes values from drop down in alert

    $("#year option").each(function(){
    alert($(this).val()+'-'+$(this).text());
    });


    }
  • 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-01T23:04:00+00:00Added an answer on June 1, 2026 at 11:04 pm

    How about using it like this

    for(i=0; i<lnk.length;i++)
    {
       var my_option = '<option>'+text(lnk[i])+'</option>';
       $('#selection_id').html(my_option);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following code that gets the value of a drop down list
I have added a UIScrollVIew using IB. Then using the following code i add
I have the following code. I want to add/remove check-box values to an array
I have following code: os.chdir(os.path.dirname(os.path.realpath(__file__)) + /../test) path.append(os.getcwd()) os.chdir(os.path.dirname(os.path.realpath(__file__))) Which should add /../test to
I have the following code: SPList list = web.Lists[this.ListName]; SPListItem item = list.Items.Add(); now
I have the following code in a php page <div class=vmenu> <div class=first_li><span >Add
I have written the following code choice /m Do you want to add another
I have the following bit of code, simply: $(function() { $('a.add-photos-link').live('click', function(e) { $(this).colorbox({
I'm using the following chunks of code to populate a drop down box on
I have the following code and that pulls a number of records based on

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.