adding custom js to specific post type add or edit
// hooking script for custom post type 'homework'
add_action( 'admin_print_scripts-post-new.php', 'homework_admin_script', 11 );
add_action( 'admin_print_scripts-post.php', 'homework_admin_script', 11 );
function homework_admin_script() {
global $post_type;
if( 'homework' == $post_type )
wp_enqueue_script( 'homework-admin-script', get_bloginfo('template_directory') . '/js/admin_homework.js' );
}
// in admin_homework.js file
(function ( $ ) {
"use strict";
$(function () {
// add js here
});
}(jQuery));