Skip to content
This repository was archived by the owner on Nov 22, 2021. It is now read-only.

Commit 5843a13

Browse files
author
Ke, Mingze
committed
Fixed bindClick()
1 parent c8810cb commit 5843a13

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

Diff for: code.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -290,8 +290,10 @@ Code.bindClick = function(el, func) {
290290
if (typeof el == 'string') {
291291
el = document.getElementById(el);
292292
}
293-
el.addEventListener('click', func, true);
294-
el.addEventListener('touchend', func, true);
293+
if (el) {
294+
el.addEventListener('click', func, true);
295+
el.addEventListener('touchend', func, true);
296+
}
295297
};
296298

297299
/**

0 commit comments

Comments
 (0)