Hello,

I have a form containing a list of checkboxes each with an 'amount'
attribute.  These checkboxes are in no particular order, and all have
different values for the amount attribute.  Example:

<input type='checkbox' amount='5' name='testName[]'  class='testClass'>
<input type='checkbox' amount='14' name='testName[]' class='testClass2'>
<input type='checkbox' amount='2' name='testName[]' class='testClass'>

I had hoped to use jquery to retrieve the value from the amount attribute,
subtract it from another number, and then disable any inputs of class
'puzzle' with 'amount's greater than the remaining number.

Example:

$().ready(function(){
    var remaining = 15;

   $("input[amount]").click(function(){
        if ( $(this).is(':checked'){
            var subtract = parseInt( $(this).attr('amount') );
            remaining -= subtract;
            <problem is here>
        }

    });
});


for the above code, what would be the best way to then DISABLE any and all
remaining inputs with the amount attribute that have an amount attribute
value greater than the new value of the *remaining* variable?
is it even possible?

Daniel

Reply via email to