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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T21:09:59+00:00 2026-06-04T21:09:59+00:00

I have a huge form with at least 200 input fields- text/radio/checkboxes . I

  • 0

I have a huge form with at least 200 input fields- text/radio/checkboxes.

I have divided this into several sections to structure it well and there is an update button for each section which takes the user input and persists it to the db. This is done by Ajax so I don’t have to reload the page.

How can I easily update the <span>s corresponding to the input fields with whatever the user inputs without reloading the page? DO I have to do a $("#spanid").html($("#input1").val()) on each <span> item or is there an easy way to do this?

Here’s the code for a fraction of the form.

HTML

 <form id="history" name="history" action="" method="post"> 
 <table class="normal">
        <tr><th colspan="8">HISTORY</th>
        </tr>
        <tr><td style="width:200px"><b>Chief Complaint Location</b></td>
        <td style="width:450px"><b>Comment</b></td>
        <td><b> Previous</b> </td>
        </tr>
        <tr><td>Head</td>
            <td ><input type="text" maxlength="100" name="headH" id="headH" ></td>
            <td class="data2"><span id="headSpan"><%=msmtCommentHead%></span></td>
        </tr>
        <tr><td>Neck</td>
            <td><input type="text" maxlength="100" name="neckH" id="neckH" ></td>
            <td class="data2"><span id="neckSpan"><%=msmtCommentNeck%></span></td>
        </tr>
        <tr><td>Upper Extremeties</td>
            <td><input type="text" maxlength="100" name="upperExtremetiesH" id="upperExtremetiesH"></td>
            <td class="data2"><span id="ueSpan"><%=msmtCommentUpperExtremeties%></span></td>
        </tr>
        <tr><td>Thoracic Spine</td>
            <td><input type="text" maxlength="100" name="thoracicSpineH" id="thoracicSpineH"></td>
            <td class="data2"><span id="tsSpan"><%=msmtCommentThoracicSpine%></span></td>
        </tr>
   <tr><td><input type="button" id="submitHistory" value="Update"/></td></tr>
   </table>
   </form>

Javascript:

   $(function(){
$("#submitHistory").click(function() {
    var query = $("#history").serialize();
        $.ajax( {
          type: "POST",      
          url: "/oscar/cmcc/History.do",
          dataType: "json",
          data: query  
         }); 
        document.getElementById('history_cmcc').reset();
        var date = new String("<%=date%>");
        $("#headSpan").innerHTML = $("#headH").val()+ "," + date; 

        $("#neckSpan").innerHTML = $("#neckH").val() + ","+ date; 


        $("#tsSpan").innerHTML = $("#thoracicSpineH").val() + ","+ date; 

        $("#lsSpan").innerHTML = $("#lumbarSpineH").val() + ","+ date; 

        $("#leSpan").innerHTML = $("#lowerExtremetiesH").val() + ","+ date; 

        $("#chSpan").innerHTML = $("#chestHeartH").val() + ","+ date; 
   }

Thanks!

  • 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-04T21:10:01+00:00Added an answer on June 4, 2026 at 9:10 pm

    In general you can do this:

    $('input[type=text]').each(function() {
      $(this).closest('tr').find('span').html($(this).val());
    });
    
    $('input:checked').each(function() {
    
             $(this).closest('tr').find('span').html($(this).val());
    });
    

    Update per OP comment:

    In your example if you wanted to put the label that is to the left of a radio button inside the span you could do this. This depends on your specific requirements.

    $('input[type=radio]:checked').each(function() {  
         $(this).closest('tr').find('span').html($(this).closest('tr').find('td:eq(0)').text());    
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a huge ASPX web form which has around 100 fields which need
I have a huge form that has around 110 fields columns (single row) that
I have a huge form (for an internal CMS) that is comprised by several
assume i have a huge input form, which of course representing classes. i need
I have a vaadin form with huge number of fields in it(textbox, select box
I have a huge problem with this method im trying to make. I have
I have a query page with a huge form that is filled out by
I have a huge database that has several tables that hold several million records.
I have this huge VB project which i just got from some one. i
I have a huge list of data, more than 1M records in a form

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.