I need to add a bit of document ready jQuery to post/page editors in admin. I'm hacking an old plugin that adds a text box to the editor page and handles inserting that text in a template file, but the text input is only html; this document ready function adds the class of mceEditor to the text box. This function works when I manually include it in admin-header.php, but I can't do that, of course.
I don't think I need to enqueue it, as it is not a library. Or do I? And, if applicable: what are the pros/cons of different ways to add it?
So how do I hook this or otherwise load it into the post/page editors in admin? It needs to go into the plugin file, not functions.php in the theme.
<script type="text/javascript">
jQuery(document).ready( function () {
jQuery("#dt-additional-info").addClass("mceEditor");
if ( typeof( tinyMCE ) == "object" && typeof( tinyMCE.execCommand ) == "function" ) {
jQuery("#dt-additional-info").wrap( "<div id='editorcontainer'></div>" );
tinyMCE.execCommand("mceAddControl", false, "dt-additional-info");
}
});
</script>