Permalink
Browse files

Merge pull request #14316 from the4dpatrick/master

Add preventDefault() on click event
  • Loading branch information...
2 parents 70ff31d + 91156b6 commit 5ecb52c36e4b1fede7d89cb2f18226847595145e @arthurnn arthurnn committed Mar 7, 2014
Showing with 3 additions and 1 deletion.
  1. +3 −1 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)

0 comments on commit 5ecb52c

Please sign in to comment.