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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T00:12:36+00:00 2026-06-16T00:12:36+00:00

I need to select dynamic id using JQuery, and once I select it then

  • 0

I need to select dynamic id using JQuery, and once I select it then I need to do some action on it. This is the HTML that I have:

<input id="content_photos_attributes_1355755712119_image"   name="content[photos_attributes][1355755712119][image]" size="30" type="file">

Please note the id value, text is always the same however the number changes (I do not have control over that change).

What I need to do is to create on click for that element. This is what I got so far, and it is not working.

<script type="text/javascript">
jQuery.noConflict();

  jQuery("input[id *= 'content_photos_attributes_']").click(function() {

  alert("Image deletion is clicked");
});
</script>

It really makes no difference whether I select that element by ID or by its name.

  • 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-16T00:12:37+00:00Added an answer on June 16, 2026 at 12:12 am

    As i see this it should be in the $(document).ready(); handler and its a dynamic id so for this you have to use .on() handler to select the selector:

    $(document).ready(function(){
        jQuery(document).on('click', 'input[id^="content_photos_attributes_"]', function() {
           alert("Image deletion is clicked");
        });
    });
    

    try this and see if helps.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to select dynamic id using JQuery, and once I select it then
I have very long select query which i need to filter based on some
I am using Eric Hynds’ jQuery for a multi-select list. I have created the
I need some help. I want to create a dynamic line chart using Google's
Im using the jQuery dynamic form plugin , but i need support for nested
I'm working on making a dynamic HTML table using jQuery. In a table, my
I need to select elements of a certain class except children of $(this). The
It looks like #temptables created using dynamic SQL via the EXECUTE string method have
I implemented Dynamic DataSource Routing for Spring+Hibernate according to this article . I have
I need to be able to return a list of files that meet some

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.