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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T22:03:52+00:00 2026-06-12T22:03:52+00:00

I am working on a simple form demo and i would like the input

  • 0

I am working on a simple form demo and i would like the input to display in a below the form. Currently i have it populating in the console. How do i may it display in the div when i click the submit button?
My code:

$(document).ready(function() {
    $('.submitForm').on('click',function(event){
        event.preventDefault();     

        $('#firstName').val();
        $('#lastName').val();
        $('#phoneNumber').val();
        $('#address').val();    

        console.log($('#firstName').val());
        console.log($('#lastName').val());
        console.log($('#phoneNumber').val());
        console.log($('#address').val());
    });
});                 
  • 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-12T22:03:53+00:00Added an answer on June 12, 2026 at 10:03 pm

    Well, you’re currently not putting the values anywhere but into the console.log.

    I would expect to see something like (let’s call your div you want the values to go to, “output”):

    $(document).ready(function() {
        $('.submitForm').on('click',function(event){
            event.preventDefault();
    
            // Borrowing from another response, this is better
            // Putting these in variables protects you from 
            // 1) accidentally modifying your form values
            // 2) invalid input, if you add some basic checks, like
            //    testing to see if the length is > 0, doesn't contain
            //    bad characters, etc.
            var firstName = $('#firstName').val(),
                lastName  = $('#lastName').val(),
                phone     = $('#phoneNumber').val(),
                address   = $('#address').val();
    
            // get a reference to the div you want to populate
            var $out = $("#output");
    
            // This is a better way of dealing with this
            // because every call to .append() forces DOM
            // reparsing, and if you do this too often, it can cause
            // browser slowness. Better to put together one string
            // and add it all at once.
            $out.html("<p>" + firstName + "</p>" + 
                      "<p>" + $('#lastName').val() + "</p>" +
                      "<p>" + $('#phoneNumber').val() + "</p>" + 
                      "<p>" + $('#address').val() + "</p>");                    
        });
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am working on a simple contact form written in php and have almost
I have simple php validation form that is halfway working. If you leave the
I am working on simple form to validate fields like this one. public class
I am working on simple login form. I have two text fields as user
I have simple form: <form action=add.php method=post > <input name=name maxlength=30/><br/> <textarea cols=80 name=description
I have a simple 'Working' form that runs on its own thread to keep
I have a decent working web application (Java/Servlet/Jsp) that I would like to improve
I'm currently working on a simple form that stores users inputted information to a
Recently I am working on symfony. I have created a simple form and want
I'm working on a simple login form and i have this redirect URL: <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.