[wp-hackers] Adding onclick event to Publish button

Austin Matzko if.website at gmail.com
Wed Jul 9 01:19:20 GMT 2008


On Tue, Jul 8, 2008 at 6:01 PM, James Davis <james at freecharity.org.uk> wrote:
> A little debugging seems to indicate that document.getElementById("publish")
> returns null but I've got idea why. Any suggestions?

The admin_print_scripts* action hooks get called in the header, so if
you run your script at that point no element of id "publish" yet
exists.  You need to let the entire document load first.  Fortunately,
WordPress makes this easy for you by defining the "addLoadEvent"
function on every admin page; just pass a function to it that you wish
to execute when the DOM is ready.


More information about the wp-hackers mailing list