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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T15:25:31+00:00 2026-05-23T15:25:31+00:00

After cloning a select element and incrementing the name attribute, I am unable to

  • 0

After cloning a select element and incrementing the “name” attribute, I am unable to select the cloned elements.

For example:

HTML

<select name="1"></select>

<select name="1-1"></select> <!-- cloned element -->
<select name="1-2"></select> <!-- cloned element -->

JS

$('[name^="1"]').change(function() {
    alert(1);
});

When I change the original element, it works fine I get the alert, but when I change one of the cloned elements, nothing happens. There are no errors.

Note: I am using “name” attribute instead of ID because I need to retrieve these cloned element values once the form is submitted

Should this work?? or is it that the cloned elements cant be selected?

  • 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-23T15:25:32+00:00Added an answer on May 23, 2026 at 3:25 pm

    Here’s the doc link for live()DOC and here’s the one for delegate()DOC

    $('[name^=1]').live('change', function(){
      console.log('hi!');
    });
    

    Although it functions differently than a regular event handler (it’s actually listening for events on the document, so it “handles” the event on propagation. Delegate is a little more efficient because you give it a context to listen on:

    $('form').delegate('select[name^=1]', 'change', function(){
      console.log('hi there!');
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

After cloning the latest stable versions of rails (2.3.2), rspec (1.2.2), cucumber (0.2.0.4...came out
After cloning an SVN repository using git-svn with the -s option ( git svn
I am cloning a hidden table row then populating it and after validation I
I started cloning an SVN repository using the git-svn's clone operation. After about 6
Got a bluescreen in windows while cloning a mercurial repository. After reboot, I now
Here's some example code: <input type=checkbox id=send-notice name=send-notice value=1 /> This is a notice
for writing images on a html page i want to write only after closing
In the following excerpt, I am trying to copy and paste everything after @Html.DisplayFor
After cloning playframework from github and importing java sources into eclipse there are a
Is it a good practice to set stream references to null after closing them?

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.