javascript - jQuery datepicker working in front end but not wordpress admin dash -


i have current code enqueuing jquery date picker:

function register_my_scripts() {     wp_register_script('scripts', plugins_url('/js/scripts.js', __file__));     wp_enqueue_script('scripts');     wp_enqueue_script('jquery-ui-datepicker'); }  function register_my_styles() {     wp_enqueue_style('e2b-admin-ui-css','http://ajax.googleapis.com/ajax/libs/jqueryui/1.9.0/themes/base/jquery-ui.css',false,"1.9.0",false); }  add_action('wp_enqueue_scripts', 'register_my_scripts'); add_action('wp_enqueue_scripts', 'register_my_styles');  

the jquery function inside scripts.js:

jquery(document).ready(function(){     jquery('.datepicker').datepicker({         dateformat : 'd, m/d/yy'     }); }); 

and html field:

<input type="text" class="datepicker"/> 

this code work fine on front end reason doesn't on end. need work on backend.

what's going on here?

probably, need serve scripts on admin_enqueue_scripts instead of wp_enqueue_scripts

add_action('admin_enqueue_scripts','register_my_scripts'); 

see this link more details


Comments

Popular posts from this blog

apache - PHP Soap issue while content length is larger -

asynchronous - Python asyncio task got bad yield -

javascript - Complete OpenIDConnect auth when requesting via Ajax -