diff --git a/challenges/04-data-visualization/json-apis-and-ajax.json b/challenges/04-data-visualization/json-apis-and-ajax.json
index 91a3c16253..0461c69773 100644
--- a/challenges/04-data-visualization/json-apis-and-ajax.json
+++ b/challenges/04-data-visualization/json-apis-and-ajax.json
@@ -88,7 +88,7 @@
],
"tests": [
"assert(code.match(/document\\.getElementById\\(\\s*?('|\")getMessage\\1\\s*?\\)/g), 'message: Your code should use the document.getElementById
method to select the getMessage
element.');",
- "assert(code.match(/\\.onclick=function\\(\\s*?\\)\\s*?{\\s*?};/g), 'message: Your code should add an onclick
event handler.');"
+ "assert(typeof document.getElementById('getMessage').onclick === 'function', 'message: Your code should add an onclick
event handler.');"
],
"solutions": [],
"hints": [],
@@ -691,4 +691,4 @@
"translations": {}
}
]
-}
\ No newline at end of file
+}