Reputation: 29
I have this code:
<% @hello = "hello world" %>
<td class="text"><%= link_to project.name, project,
:onmouseout=>"hidetooltip()",
:onmouseover=>"showDescription()"%>
</td>
The showDescription
JavaScript function takes a string parameter. I want to pass @hello
as a parameter to showDescription
. I tried everything and can't seem to get it to work.
Upvotes: 0
Views: 405
Reputation: 65
another way to do that is using gem client variable. It helps you to do it easily
Upvotes: 0
Reputation: 115531
Here you go:
<% @hello = "hello world" %>
<%= link_to project.name, project, :onmouseout=>"hidetooltip()",
:onmouseover=>"showDescription(#{ @hello.to_json })"%>
Upvotes: 2