# Javascript\_tag

**URL:** <https://www.ruby-forum.com/t/javascript-tag/132750>\
**Category:** Rails\
**Created:** [March 24, 2008, 12:23pm UTC](https://www.ruby-forum.com/t/javascript-tag/132750 "2008-03-24T12:23:47Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![joel](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/b9bd4f/32.png) [@joel](https://www.ruby-forum.com/u/joel)\
**Post date:** [March 24, 2008, 12:23pm UTC](https://www.ruby-forum.com/t/javascript-tag/132750/1 "2008-03-24T12:23:47Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![joel](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/b9bd4f/32.png) [@joel](https://www.ruby-forum.com/u/joel)\
**Post date:** [March 24, 2008, 1:24pm UTC](https://www.ruby-forum.com/t/javascript-tag/132750/2 "2008-03-24T13:24:02Z")

</div>

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’ %\>
