Created
January 3, 2023 13:17
-
-
Save vfontjr/83210a57ccafed9f31bffc32aa1347e3 to your computer and use it in GitHub Desktop.
This file contains 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
<script> | |
jQuery(document).ready(function($) { | |
"use strict"; | |
$('#field_xxx').on('change', function() { | |
var total = 0; | |
if ( $(this).val().length > 0 ) { | |
const split_vals = $(this).val().split(", "); | |
var total = 0; | |
for (var i = 0; i < split_vals.length; i++) { | |
total += split_vals[i]; | |
} | |
} | |
$(this).val(total); | |
}); | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment