con este codigo casi cumple lo que quiero pero depeus del alert me deja incremetar los numeros hasta que cada casilla llega a 10, pero lo que necesito es que cuando el total me lelgue a 10 deje de incrementar los demas input alguien tien una forma mas adecuada de realizar este pequeño script?
Código Javascript
:
Ver originalvar limite = 10;
$(document).ready(function()
{
input = $("#a");
input2 = $("#s");
$("body").keyup(function(e)
{
var total = 0;
$(".grupo .total").each(function() {
total = total + parseInt($(this).html());
if (total > (limite - 2))
{
alert("Ya se llego al limite");
return false;
}
})
if (e.which == 65) {
if (input.val() == limite)
{
alert("Ya se llego al limite");
return false;
}
input.val((input.val() * 1) + 1);
}
if (e.which == 83) {
if (input2.val() == limite)
{
alert("Ya se llego al limite");
return false;
}
input2.val((input2.val() * 1) + 1);
}
var a = $(this).find("input[name=a]").val();
var s = $(this).find("input[name=s]").val();
$(this).find("[class=total]").html(parseInt(a) + parseInt(s));
});
});