aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArthur Nogueira Neves <arthurnn@gmail.com>2014-03-07 14:04:41 -0500
committerArthur Nogueira Neves <arthurnn@gmail.com>2014-03-07 14:04:41 -0500
commit5ecb52c36e4b1fede7d89cb2f18226847595145e (patch)
tree61cc408f2266188d94a91685c0bbca164b6a4353
parent70ff31d69f017d1bc674b913865d5a008de0c8a6 (diff)
parent91156b6f0ced65b5681874e2cf2a95e045d708e9 (diff)
downloadrails-5ecb52c36e4b1fede7d89cb2f18226847595145e.tar.gz
rails-5ecb52c36e4b1fede7d89cb2f18226847595145e.tar.bz2
rails-5ecb52c36e4b1fede7d89cb2f18226847595145e.zip
Merge pull request #14316 from the4dpatrick/master
Add preventDefault() on click event
-rw-r--r--guides/source/working_with_javascript_in_rails.md4
1 files changed, 3 insertions, 1 deletions
diff --git a/guides/source/working_with_javascript_in_rails.md b/guides/source/working_with_javascript_in_rails.md
index a8695ec034..aba3c9ed61 100644
--- a/guides/source/working_with_javascript_in_rails.md
+++ b/guides/source/working_with_javascript_in_rails.md
@@ -111,7 +111,9 @@ paintIt = (element, backgroundColor, textColor) ->
element.style.color = textColor
$ ->
- $("a[data-background-color]").click ->
+ $("a[data-background-color]").click (e) ->
+ e.preventDefault()
+
backgroundColor = $(this).data("background-color")
textColor = $(this).data("text-color")
paintIt(this, backgroundColor, textColor)