Kode dari tutorial https://solusipress.com/format-angka-pada-calculation-field-forminator/
<?php | |
add_action( 'wp_enqueue_scripts', 'solusipress_jquery_number' ); | |
function solusipress_jquery_number() { | |
if( is_page( 'forminator-test' ) ) { | |
wp_enqueue_script( 'jquery-number', 'https://businessprofile.solusipress.com/wp-content/uploads/custom-css-js/18.js' ); | |
} | |
} | |
add_action( 'wp_footer', 'solusipress_forminator_format_number' ); | |
function solusipress_forminator_format_number() { | |
if( is_page( 'forminator-test' ) ) { ?> | |
<script type="text/javascript"> | |
( function($){ | |
$( '#calculation-1-field' ).hide(); | |
$( '#calculation-1-field' ).parent().append( '<div id="total_html" style="font-weight:600;font-size:22px"></div>' ); | |
set_total(); | |
$( '#calculation-1-field' ).on( 'change', function(){ | |
set_total(); | |
} ); | |
function set_total() { | |
var tot = $('#calculation-1-field').val(); | |
$( '#total_html' ).html( 'Rp' + $.number( tot, 0, ',', '.' ) ); | |
} | |
} )( jQuery ); | |
</script><?php | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment