Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <input type="number" name="quanti" id="quanti" class="form-control"
- onInput="validarInput('<?php echo $row["idArticulo"]; ?>')"
- onKeyPress="return soloNumeros(event)"
- />
- <button type="submit" name="add_to_cart" id="<?php echo $row['idArticulo']; ?>"
- class="btn btn-warning add_to_cart" >Agregar al carrito</button>
- <!-- acepta solo numeros, funciona bien-->
- <script type="text/javascript">
- function soloNumeros(e) {
- var key = window.Event ? e.which : e.keyCode;
- return ((key >= 48 && key <= 57) ||(key==8))
- }
- </script>
- <script type="text/javascript>
- function validarInput(iden) {
- /*Funcion del botón, funciona bien, pero solo cuando yo escribo*/
- document.getElementById(iden).disabled = !document.getElementById("quanti").value.length;
- }
- </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement