Javascript_tag

Hi !

I’m a newbie to rails. I’m trying to add javascript tags to my view
the following way :

@events.each do |e|
      [...]
%(javascript_tag 'new

Popup(‘event_popup_#{e.id}’,‘event_link_#{e.id}’)’)
[…]
end

This code is not working unfortunately, and the js tags are missing in
my html source code.

Can somebody help me with this issue. I guess I didn’t use the correct
syntax.

joel wrote:

%(javascript_tag 'new

Popup(‘event_popup_#{e.id}’,‘event_link_#{e.id}’)’)

If this is in a view, then to embed JS you want:

<%= javascript_tag ‘some javascript code’ %>

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