I would like to add some jQuery to wordpress/woocommerce admin page. The code works good on the client page but never pass to wp-admin page.
This is the code:
jQuery("#postbox-container-1").ready(function(){
alert("now what?");
$('p:contains("Poivre")').css('color', 'red');
});
You can use WP admin_footer
action hook to add custom js to the admin side. check below code. code will go in the active theme functions.php file.
function add_custom_admin_js(){
?>
<script type="text/javascript">
(function($){
$("#postbox-container-1").ready(function(){
alert("now what?");
$('p:contains("Poivre")').css('color', 'red');
});
})(jQuery);
</script>
<?php
}
add_action( 'admin_footer', 'add_custom_admin_js', 10, 1 );
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.