My problem is as follows: I assigned an id to my button that contains the value of a PHP query. Here the code:
<input type="text" name="Articulo" id="Articulo" value="1"/>
<input type="number" name="quanti" id="quanti" class="form-control"
value="1"/>
<!-- aqui el boton le asigno como id un valor de PHP-->
<!-- este valor lo obtengo de la base de datos -->
<button type="submit" name="add_to_cart" id="<?php echo $row['idArticulo']; ?>"
class="btn btn-warning add_to_cart" >Añadir al carrito
</button>
The problem is how to get the value of that id and call it in javascript:
<script type="text/javascript">
//***
function validarInput() {
//no sé cómo obtener ese valor del id y colocarlo
document.getElementById('aquí el problema').disabled = !document.getElementById("quanti").value.length;
}
</script>