Created
March 23, 2009 21:55
-
-
Save laktek/83810 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#without :ujs option | |
link_to_function("Greeting", "alert('Hello world!')") | |
# <a href="#" onclick="alert('Hello world!'); return false;">Greeting</a> | |
#with :ujs and :id option | |
link_to_function("Greeting", "alert('Hello world!')", :id => "greeting_link", :ujs => true) | |
# <a href="#" id="greeting_link">Greeting</a> | |
# <script type="text/javascript"> | |
# //assuming users JS framework of choice is jQuery | |
# $(\"#greeting_link\").click( function(){ alert('Hello world!'); return false } ); | |
# </script> | |
#with :ujs and :class option | |
link_to_function("Greeting", "alert('Hello world!')", :class => "greeting_link", :ujs => true) | |
link_to("Greeting", "#", :class => "greeting_link") | |
# <a href="#" class="greeting_link">Greeting</a> | |
# <a href="#" class="greeting_link">Greeting</a> | |
# <script type="text/javascript"> | |
# //assuming users JS framework of choice is jQuery | |
# $(\".greeting_link\").click( function(){ alert('Hello world!'); return false } ); | |
# </script> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment