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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T03:33:32+00:00 2026-06-09T03:33:32+00:00

In this fiddle when you select a value it populates all input fields. I

  • 0

In this fiddle when you select a value it populates all input fields. I am trying to use this same principle in this fiddle but it is not working. I am not quite sure why?

I am not getting any errors but I feel as though the below code is in the wrong spot and is being ignored?

    jQuery('#newtable select').on('change', function() {
        var div_id = 'div_'+jQuery(this).attr('id');
        var select_val = jQuery(this).find('option:selected').data('value');
        console.log();
        if( select_val != '' ) {
            var a = select_val.split(',');
            var count = 0;
            jQuery('tr#'+div_id+' .flag').each(function() {
            jQuery(this).val(a[count]);
            ++count;
            });
        } else {
            jQuery('tr#'+div_id+' input.input_text').val('');
        }
    });

What I am trying to acheive in the second fiddle is for when you select ‘Ryan $100’ it updates the below code.

    <table id="newtable">
    <tr id='div_m2'>
            <input type="hidden" class='input_text flag' value="0" name="id[]">
            <input type="hidden" class='input_text flag' value="0" name="name[]">
            <input type="hidden" class='input_text flag' value="0" name="sales[]">
            <input type="hidden" class='input_text flag' value="0" name="price[]">
            <td colspan="3">
                <select id='m2'>
    <option value="" data-value="">Choose Salesman</option>
    <option value="0" data-value="id_03,Ryan,1,100">Ryan $100</option>
    <option value="0" data-value="id_01,Tom,1,100">tom $100</option>
                </select>
            </td>
        </tr>
    </table>

to this

        <input type="hidden" class='input_text flag' value="id_03" name="id[]">
        <input type="hidden" class='input_text flag' value="Ryan" name="name[]">
        <input type="hidden" class='input_text flag' value="1" name="sales[]">
        <input type="hidden" class='input_text flag' value="100" name="price[]">

and when you do this showValues() is also run so that the above data is included in the table I am generating.

So my desired output for the table if you choose ryan $100 is.

    <table id="results">
        <tbody>
        <tr><th>Rank</th><th>Salesman</th><th>Products Sold</th><th>Total Sale Price</th><th>Commission (30% of Total Sale Price + 5 for each sale)</th></tr>
        <tr data-id="id_03"><td>1</td><td>ryan</td><td>2</td><td>110</td><td>550.00</td></tr>
        <tr data-id="id_02"><td>2</td><td>Jerry</td><td>3</td><td>60</td><td>300.00</td></tr>
        <tr data-id="id_01"><td>3</td><td>Tom</td><td>5</td><td>50</td><td>250.00</td></tr>
        </tbody>
    </table>
  • 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-09T03:33:34+00:00Added an answer on June 9, 2026 at 3:33 am

    This should solve your problem:

    http://jsfiddle.net/VNSam/19/

    If you want to update your table on select you should call showValue() 🙂

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

Sidebar

Related Questions

I am trying to select only the topmost section H1s. In this fiddle ,
Base on this question radio selected I use this way <input type=radio class=fp value=q
I am trying to use the value binding on the select element, as described
In this fiddle when user drags a div auto scroll works in chrome but
In this fiddle I'm just trying to return true : http://jsfiddle.net/WCFtp/ for jQuery key
I have this fiddle: http://jsfiddle.net/yub2B/4/ HTML: <input type=text /> <input type=text /> <input type=text
UPDATE If you try the form on this link http://jsfiddle.net/Matt_KP/BwmzQ/ the fiddle and select
I'm trying to select the first h2 in this table (which is called 'styling')
I am trying to select values of an input on focus. It initially works
Having this piece of HTML: <div id=modal> <select class=country> <option value=></option> <option value=opt>Opt</option> </select>

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.