Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add preventDefault() on click event

  • Loading branch information...
commit 91156b6f0ced65b5681874e2cf2a95e045d708e9 1 parent 70ff31d
@the4dpatrick the4dpatrick authored
Showing with 3 additions and 1 deletion.
  1. +3 −1 guides/source/working_with_javascript_in_rails.md
View
4 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)
Please sign in to comment.
Something went wrong with that request. Please try again.