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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T22:45:38+00:00 2026-06-05T22:45:38+00:00

I have a drop down menu. Has product types. Product types have associated value

  • 0

I have a drop down menu. Has product types. Product types have associated value (from drop down) values correspond to machine groups.

So each option should have three variables–Machine name, values, machine group.

I can get the Machine name and I can get the machine value (and display them in a different field)…what I have not been able to figure out is how to change the value into the Machine group.

jQuery('#MachineName').bind('change', function()
    {

      //get selected value from drop down;
        var selectedValue = jQuery("#MachineName").val();

      //populate a text field with the selected drop down value
        jQuery("#MachineValue").val(selectedValue);

What I would like to do is keep that MachineValue but then populate another text field with the sorted MachineGroup

I have been trying to run it through something like

    switch(jQuery(this).val()){
    case "236" : newVal = "8";
    break;

But I don’t want to “change” the value I just want to do an “if then” type filter, so maybe something like:

    '236' => "8", '237' => "5",

I just don’t know how to properly say “assign the MachineGroup based on the MachineValue” (and then have it populate a different text field)

In the end I would have three fields. The drop down, the MachineValue and the MachineGroup. Drop down and value are done, I just need to do Group. (And I can sort Group based on MachineName…just not sure which would be easier)

  • 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-05T22:45:39+00:00Added an answer on June 5, 2026 at 10:45 pm

    The simplest at client side is to have server add some extra data- attributes to the markup. jQuery.data() makes it very easy to retrieve these.

    html:

    <option value="5" data-group="foo" data-name="Bar">Bar</option>
    

    JS:

    $('select').change(function(){
        var $sel=$(this).find('option:selected');
        var machineGroup=$sel.data('group');
        var machineName=$sel.data('name');
        var value= $sel.val()// or $(this).val();
    });
    

    API ( read down below first series of examples, feature wasn’t in original API)

    http://api.jquery.com/data/

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

Sidebar

Related Questions

I have a drop down menu with 3 values. each has an option id.
I have a page with several multiselect drop-down menus. Each menu has a general
I have a drop down menu. It has consists of month, January until December.
I have a JQuery drop down menu which has animated when we hover the
I have a drop down menu that has fading background images done by haveing
I have been working on a drop down menu, that has different colors for
I have a drop down menu which has the following html structure: <ul class=menu>
I have a drop down menu in an ASPX page along the lines of:
I have a drop down menu made with Jquery. Right now, if you hover
We have a drop-down menu of volumes in our UI, and I'd like to

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.