Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

92
Views
How to make form input value in A to appear in B using jQuery or JavaScript

How to type something in form input a and display it in form input b and in div c?

Let's assume that I enter value 100 in form input a, how can I make it to appear in form input b and div c as I type?

The code below is not working properly:

<script>
$(function() {
    $('[name="b"]').on('change', function() {
        $('[name="a"]').val($(this).val());
    });
});
</script>

<input type="text" id="a" name="a" value="">
<input type="text" id="b" name="b" value=""/>

<div id="c" class="c"></div>
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Add the event listener to the input whose name is a instead of b:

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>

<script>
$(function() {
    $('[name="a"]').on('input', function() {
        $('[name="b"]').val($(this).val());
    });
});
</script>

<input type="text" id="a" name="a" value="">
<input type="text" id="b" name="b" value=""/>

<div id="c" class="c"></div>

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!