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
This commit is contained in:
parent
eb0e8e216f
commit
c8350949d9
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user