Advertisement
contatowellington

Untitled

Nov 22nd, 2018
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.35 KB | None | 0 0
  1. <script>
  2. function calcular(el) {
  3. const valor = document.getElementById('valor');
  4. const precoPorLetra = 0.03;
  5. const espacos = (el.value.split(" ").length - 1); //conta espacos
  6. const caracteres = el.value.length;
  7. off.value = parseFloat( (caracteres - espacos) * precoPorLetra).toFixed(2); //formatado para duas casas decimais
  8. }
  9. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement