diff --git a/IPython/html/static/edit/js/main.js b/IPython/html/static/edit/js/main.js
index cb5f194..61822e3 100644
--- a/IPython/html/static/edit/js/main.js
+++ b/IPython/html/static/edit/js/main.js
@@ -93,5 +93,5 @@ require([
window.onresize = _handle_resize;
// On document ready, resize codemirror.
- $(_handle_resize);
+ $(document).ready(_handle_resize);
});