DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Snippets has posted 5883 posts at DZone. View Full User Profile

Please Check Your Email And Active Your Account Javascript And Link_to

09.03.2008
| 5434 views |
  • submit to reddit
        Use this Link with onclick in the view

<%= link_to(ok_button, '#', :onclick => "javascript: Control.Modal.close(); return false;")%>
    

Comments

Manuel Meurer replied on Wed, 2008/04/23 - 12:26pm

First: you don't need 'javascript:' in your onclick event, the content is always Javascript. Second: Use link_to_function to create a link to a Javascript function. Like so: <%= link_to_function ok_button, 'Control.Modal.close()' %> The generated HTML is the same.