Alter taxonomy selector with Jquery
-
WP5.3
I am trying to alter the taxonomy selection with some jquery.
So I added the following in my custom plugin:function sts_plugin_enqueue(){ wp_register_script( 'sts-script', plugin_dir_url( __FILE__ ) . 'public/js/sts_script.js' ); wp_enqueue_script( 'sts-script' ); } add_action( 'admin_enqueue_scripts', 'sts_plugin_enqueue' );
First step for checking, sts_script.js content is:
(function($){ alert( "Hello World" ); })(jQuery);
It WORKS when i open post edit page, the script is correctly embedded.
Second step, see if I can select some DOM element, sts_script.js content is:
(function($){ $('.editor-post-taxonomies__hierarchical-terms-choice').mouseenter( function(){ alert( "Hello World" ); }); })(jQuery);
It DOESN’T work ??
Same behaviour with other event instead of mousenter, (click,etc…)
I can seeclass='editor-post-taxonomies__hierarchical-terms-choice'
in page elements, so why can’t I alter it??
Viewing 9 replies - 1 through 9 (of 9 total)
Viewing 9 replies - 1 through 9 (of 9 total)
- The topic ‘Alter taxonomy selector with Jquery’ is closed to new replies.