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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T11:04:31+00:00 2026-06-08T11:04:31+00:00

I have a question with jQuery. Can one not pass the id’s to a

  • 0

I have a question with jQuery. Can one not pass the id’s to a javascript function containing jQuery with certain events?

For example, load_dll works perfectly. I’m struggling to get update_dll to work properly.

 //Create values for drop down list
var empType = ['Sales Associate', 'New Hire Sales Associate', 'Post-Hire Graduation', 'Senior Supervisor'];
//initialize values
load_ddl(empType, 'empTypeddl');
update_dll('empTypedll', 'empType');
//Populate drop down list function
function load_ddl(arr, id) {
    for (i = 0; i < arr.length; i++) {
        $('<option/>').val(arr[i]).html(arr[i]).appendTo('#' + id);
    }
}
//Update Function
function update_ddl(source_id, target_id) {
    $('#' + source_id).change(function() {
        alert($('#' + source_id + ' option:selected').attr('value'));
    });
}

If I simplify it down to it’s most basic form it works though. Is it possible to pass the id’s?

$('#empTypeddl').change(function() {
     alert($('#empTypeddl option:selected').attr('value'));
});
  • 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-08T11:04:32+00:00Added an answer on June 8, 2026 at 11:04 am

    Try passing in the source_id as even data like so:

    //Update Function
    function update_ddl(source_id, target_id) {
        $('#' + source_id).change({source_id: source_id}, function(event) {
            alert($('#' + event.data.source_id + ' option:selected').attr('value'));
        });
    }
    

    This creates a data property and appends it to the event object.

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

Sidebar

Related Questions

i have one question about jquery ajax().. I created a table grid and there
Really quick jQuery question... I have this function: $(document).ready(function() { $('a#show1').click(function() { $('.item1').toggle(1000); return
Javascript and jQuery (Fancybox) question I'm using the Javascript function below for Twitter sharing
I'm one day into learning JQuery and have a question about the octothorpe syntax.
Can any one help me please, I have two sections of my question. What
I have a generic JavaScript function which takes one parameter function foo(val) { ...}
I have a question about animation queues in jQuery. Let's talk over an example.
I assume this one is rather a JavaScript/jQuery/DOM question than a Rails question, but
I have a question regarding jQuery's live() function. I am programming a forum. As
I have a question about jQuery load best practice. Imagine the following situation: $(#div).on('click',

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.