Currency (price) formating on custom fields


I need to format a custom field in admin area (post edit) as a currency, eq: 12.000,00 , with user typing only the numbers, the , and . automatic. Ive searched arround, with no sucess.. Anyone? thank

The code i am trying to use to enqueue script in admin is

function enqueue_admin() {

    wp_enqueue_script( 'jquery' ); //adding Jquery to admin. Not sure if is needed or already there
    wp_register_script( 'autonum', THEME_DIR . '/js/vendor/autoNumeric.js', array( 'jquery' ), '1', false ); //this is autoNumeric for currency format
    wp_enqueue_script( 'autonum' );

add_action( 'admin_enqueue_scripts', 'enqueue_admin' );

Also, not sure if i need to change all the $ to JQuery in autoNumeric.js, because of wordpress compatibility

user1576978 3 years 2020-06-01T03:11:06-05:00 0 Answers 90 views 0

Leave an answer