no DOM in wordpress admin
Posted
by
Chris
on Stack Overflow
See other posts from Stack Overflow
or by Chris
Published on 2012-09-23T21:25:59Z
Indexed on
2012/09/23
21:37 UTC
Read the original article
Hit count: 210
I correctly inserted a javascript file into the wordPress admin with :
wp_enqueue_script()
I know that the script is loading. I tested it with an alert()
.
I then found that I am unable to access the DOM. When I tried :
document.getElementsByTagName('body')[0].addEventListener('load', function() {});
This error was:
Uncaught TypeError: Cannot call method 'addEventListener' of undefined
This is the first time I have used 'settings api' or inserted scripts into the WordPress admin.
© Stack Overflow or respective owner