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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T16:21:59+00:00 2026-05-27T16:21:59+00:00

The Problem: When i clone <div id=#cloneme1>…</div> i get <div id=cloneme2>…</div> but the .keyup()

  • 0

The Problem: When i clone
<div id="#cloneme1">...</div> i get
<div id="cloneme2">...</div> but the .keyup() function wont read the new DOM elements

$('#btnAdd').click(function() {
      var num= $('.clonedInput').length; // how many "duplicatable" input fields we currently have
      var newNum= new Number(num + 1);      // the numeric ID of the new input field being added

      // create the new element via clone(), and manipulate it's ID using newNum value
      var newElem = $('#cloneme' + num).clone().attr('id', 'cloneme' + newNum);

      // manipulate the name/id values of the input inside the new element
      newElem.children(':first').attr('id', 'alteredguianswer' + newNum)

      // insert the new element after the last "duplicatable" input field
      $('#cloneme' + num).after(newElem);
    });

    $('input[type="text"]').keyup(function(){
                var id = $(this).attr("id"); // variable id = id of current textfield
                var value=$(this).val();  // variable value = value in current textfield
                $("#someplace"+id).text(value);  // edit text elsewhere on page using value
            });


<div>
     <input type="button" id="btnAdd" value="add another name" />
</div>
     <div id="cloneme1" style="margin-bottom:4px;" class="clonedInput">Question:<input type="text" id="guianswer1" value="Answer 1" /></div>

I dont understand how to get a function to read the new cloned elements

  • 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-27T16:21:59+00:00Added an answer on May 27, 2026 at 4:21 pm

    You’re binding the keyup event for all matching elements in the DOM, but not future elements.

    If you’re using jQuery 1.7 or later, try using on

    $('input[type="text"]').on('keyup', function(){
        var id = $(this).attr("id"); // variable id = id of current textfield
        var value=$(this).val();  // variable value = value in current textfield
        $("#someplace"+id).text(value);  // edit text elsewhere on page using value
    });
    

    If you’re using an earlier version, try using live

    $('input[type="text"]').live('keyup', function(){
        var id = $(this).attr("id"); // variable id = id of current textfield
        var value=$(this).val();  // variable value = value in current textfield
        $("#someplace"+id).text(value);  // edit text elsewhere on page using value
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using the following script to clone a div with form elements inside;
I've ran into a problem when cloning a template div to create elements for
I have a problem switching the content of a div using jQuery functions clone
I'll get straight to the point, I am using jQuery to clone a div
Hey all, i have a problem with trying to get 2 forms to close
Problem: I have two spreadsheets that each serve different purposes but contain one particular
My problem is similar to the below link How to get the dropped item's
I'm trying to use jQuery to add dynamic Add/Remove row function, but I meet
EDITED : The problem is with the function 'find_callback', I want to insert each
I am using jquery to clone and append some html into a div. My

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.