Inserting a static img tag with jQuery

Rails 3.1.3

This should be a basic question but it does not work for me, so I need
some help.

I would like to insert an image with jQuery after loading the page is

More specifically,

$('#combine').click(function () {


this way. It does not work. I understand that the problem is the PATH.
The image is saved in “app/assets/images”.

$('#combine').click(function () {

$(’#tempimage’).html(’<%= image_tag ("/images/arrow_close.png") %>’);

this does not work either.

How can I do it?

Thanks in advance.


This here is useful stuff to read:

If not configured differently, the images that you have stored under
app/assets/images/arrow_close.png end up with an url of “/assets/
arrow_close.png” - it’s always a good idea to try this out in the
browser first and to check the console to see how the pipeline
processes the resources - the output here is usually quite verbose.

hope this helps,

Thanks for your help!

It works fine now.


This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs