После того, как я обновил плагин ACF, мой файл JS функции onchange больше не работает в wordpress function.php.Я не знаю, что с этим случилось.Вот мой кодНе могли бы вы просветить меня?
irevent_script.JS
(function($) {
$('#acf-field-acf_event_type').on('change', function () {
var selectVal = $("#acf-field-acf_event_type option:selected").val();
if(selectVal=="Others") {
$("#title").val("");
} else {
$("#title").val(selectVal);
}
});
})( jQuery );
In function.php
function irevent_script( $hook_suffix ){
$cpt = 'irevent';
if( in_array($hook_suffix, array('post.php', 'post-new.php') ) ){
$screen = get_current_screen();
if( is_object( $screen ) && $cpt == $screen->post_type ){
//wp_enqueue_script( 'tinymce_js', includes_url( 'js/tinymce/' ) . 'wp-tinymce.php', array( 'jquery' ), false, true );
wp_enqueue_script('irevent_js_script', get_bloginfo('template_url').'/js/irevent_script.js', array('jquery'), '4.7.5', true);
}
}
}
add_action( 'admin_enqueue_scripts', 'irevent_script');