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

  • submit to reddit
        Use this Link with onclick in the view

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


Manuel Meurer replied on Wed, 2008/04/23 - 11:26am

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.