Advertisement
Guest User

Untitled

a guest
Aug 18th, 2017
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. <input type="number" name="quanti" id="quanti" class="form-control"
  2. onInput="validarInput('<?php echo $row["idArticulo"]; ?>')"
  3. onKeyPress="return soloNumeros(event)"
  4. />
  5.  
  6. <button type="submit" name="add_to_cart" id="<?php echo $row['idArticulo']; ?>"
  7. class="btn btn-warning add_to_cart" >Agregar al carrito</button>
  8.  
  9. <!-- acepta solo numeros, funciona bien-->
  10. <script type="text/javascript">
  11. function soloNumeros(e) {
  12. var key = window.Event ? e.which : e.keyCode;
  13. return ((key >= 48 && key <= 57) ||(key==8))
  14. }
  15. </script>
  16.  
  17. <script type="text/javascript>
  18. function validarInput(iden) {
  19. /*Funcion del botón, funciona bien, pero solo cuando yo escribo*/
  20. document.getElementById(iden).disabled = !document.getElementById("quanti").value.length;
  21. }
  22. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement