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

  • Home
  • SEARCH
  • 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 6929503
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T11:19:35+00:00 2026-05-27T11:19:35+00:00

i want to copy the input from a user to multiple div’s. I tried

  • 0

i want to copy the input from a user to multiple div’s.
I tried to use .each() because i want to apply it to every div that follows.
I wrote this code so far, but it’s only working for the first div.

<input type="text" name="someText" id="someText">



$("#someText").keyup(function() {
    var x = $("#someText").val();
    $("#copy").each(function () {
        $(this).html(x);
    });
});


<div id="copy"></div>
<div id="copy"></div>

Best Regards,

Felix

  • 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-05-27T11:19:35+00:00Added an answer on May 27, 2026 at 11:19 am

    IDs have to be unique:

    id = name [CS]
    This attribute assigns a name to an element. This name must be unique in a document.

    Most browsers will return the first element of a document with a given ID, though the behaviour is unspecified.

    Use classes instead if you want to select multiple elements:

    HTML:

    <div class="copy"></div>
    <div class="copy"></div>
    

    JavaScript:

    $("#someText").keyup(function() {
        $(".copy").text(this.value);
    });
    

    Some other points:

    • You don’t have to use .each, setter methods are normally always applied to all elements of the set.
    • Inside the event handler, this refers to the element the handler is bound to. You don’t have to use the selector again.
    • If you already have a reference to a DOM element, it is often simpler to just access one of its properties directly instead of going through jQuery.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to accept arbitrary user input. Later, I want to copy that input,
I want to copy files that have timestamps from the time the script begins
I have a function that I want to use to manipulate an input parameter,
I can write an app that would copy all input from cin into a
I want to copy a file from A to B in C#. How do
I want to copy text files and only text files from src/ to dst/
I want to copy some functions from OpenCV library to my embedded application. Rewriting
I want to copy values from one object to another object. Something similar to
I need to copy from input document to output document all attributes but one.
I am trying to write a Python script that will copy files from one

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.