aboutsummaryrefslogtreecommitdiffstats
path: root/guides/source/working_with_javascript_in_rails.md
diff options
context:
space:
mode:
authorPrathamesh Sonpatki <csonpatki@gmail.com>2015-12-13 09:20:54 +0530
committerPrathamesh Sonpatki <csonpatki@gmail.com>2015-12-13 09:20:54 +0530
commitc8350949d91614a1f8143cc776a9864ac98e45c4 (patch)
treeb0fd24b3a635d4a281cce62cdf19813c5a95629e /guides/source/working_with_javascript_in_rails.md
parenteb0e8e216fcf535a1e6b82720dfb7639fcc20ff2 (diff)
downloadrails-c8350949d91614a1f8143cc776a9864ac98e45c4.tar.gz
rails-c8350949d91614a1f8143cc776a9864ac98e45c4.tar.bz2
rails-c8350949d91614a1f8143cc776a9864ac98e45c4.zip
Fix paintIt method in JavaScript guides [ci skip]
- Changed "paintIt" to "@paintIt" so that it can be called in an on click handler. - Closes #22568
Diffstat (limited to 'guides/source/working_with_javascript_in_rails.md')
-rw-r--r--guides/source/working_with_javascript_in_rails.md4
1 files changed, 2 insertions, 2 deletions
diff --git a/guides/source/working_with_javascript_in_rails.md b/guides/source/working_with_javascript_in_rails.md
index 1c42ff2914..48fc6bc9c0 100644
--- a/guides/source/working_with_javascript_in_rails.md
+++ b/guides/source/working_with_javascript_in_rails.md
@@ -81,7 +81,7 @@ Awkward, right? We could pull the function definition out of the click handler,
and turn it into CoffeeScript:
```coffeescript
-paintIt = (element, backgroundColor, textColor) ->
+@paintIt = (element, backgroundColor, textColor) ->
element.style.backgroundColor = backgroundColor
if textColor?
element.style.color = textColor
@@ -107,7 +107,7 @@ attribute to our link, and then bind a handler to the click event of every link
that has that attribute:
```coffeescript
-paintIt = (element, backgroundColor, textColor) ->
+@paintIt = (element, backgroundColor, textColor) ->
element.style.backgroundColor = backgroundColor
if textColor?
element.style.color = textColor