Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <script>
- function calcular(el) {
- const valor = document.getElementById('valor');
- const precoPorLetra = 0.03;
- const espacos = (el.value.split(" ").length - 1); //conta espacos
- const caracteres = el.value.length;
- off.value = parseFloat( (caracteres - espacos) * precoPorLetra).toFixed(2); //formatado para duas casas decimais
- }
- </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement