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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T14:02:57+00:00 2026-06-02T14:02:57+00:00

I have a page with images and text. A user can upload an image

  • 0

I have a page with images and text.

A user can upload an image through a modal window. I use .js.erb to replace the image on the page with the one the user uploaded.

$('#mailing_body').contents().find("[data-edit-img='<%=escape_javascript(@user_image.location)%>']").attr('src', '<%=escape_javascript(@user_image.image.url(:medium))%>');

Now I want to a jquery function to fire when the image on the page changes.

I tried the following in my js file:

  $("#mailing_body").contents().find("[data-edit-img='header']").live('change',function(){
      alert('change');
  });

But it does not work. What am I doing wrong?

I am using Ruby 1.9, Rails 3.2.2 jquery1.7.2

  • 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-02T14:02:59+00:00Added an answer on June 2, 2026 at 2:02 pm

    jQueries Change only works on INPUT elements, unfortunately.

    What you will have to to is create an event handler and fire a trigger.
    When ever the upload is finished or whenever you expect the image to change you can use jQueries event and trigger system

    $('#foo').bind('customEvent', function() {
          alert($(this).text());
    });
    
    $('#foo').trigger('customEvent');
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a simple page with images, and when the user clicks the image,
I have images on my page. User can add more images onto the page
I have stored page contents (tables, plain text, images and paragraphs) into a variable.
I have an Asp.Net page containing one GridView and a couple of images (google
I have a page where I am loading bunch of images initially when the
a I have some images on page and I want to put <span> tag
I have three divs page-left page-right flipper I have images of equal size in
I have 5 images on my page. These images are layered on each other
I have a list of images which I want to display in a page.
I have a page with an image. I want the client to be able

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.