Skip to content

Instantly share code, notes, and snippets.

@dantetesta
Created March 16, 2022 16:42
Show Gist options
  • Save dantetesta/cdf471c83dbd0b0eacec403f35228536 to your computer and use it in GitHub Desktop.
Save dantetesta/cdf471c83dbd0b0eacec403f35228536 to your computer and use it in GitHub Desktop.
<script>
jQuery( document ).ready(function() {
function pad(num, size) {
var s = num+'';
while (s.length < size) s = '0' + s;
return s;
}
jQuery('#total').hide();
jQuery('#número-fatura').css('pointer-events','none');
var total = 1 + parseInt(jQuery('#total h2').text());
var data = new Date();
var mes = data.getMonth();
var ano = data.getFullYear();
var result = pad(total,4) + '-' + mes +'/' + ano;
jQuery('#numero-fatura').val(result);
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment