Last active
April 22, 2020 15:17
-
-
Save yeriepiscesa/23c6acd227575451e64d480e7a88f024 to your computer and use it in GitHub Desktop.
Kode dari tutorial https://solusipress.com/format-angka-pada-calculation-field-forminator/
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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