var ammount = parseInt( $("timestartmin").attr("ammount") );

$(this).siblings().each(
>
> function(){

var ammount = parseInt( $("timestartmin").attr("ammount") );

>
>    if(ammount > remaining){ $(this).attr("disabled",
> true) }
> });



On Thu, May 14, 2009 at 1:50 PM, oly.yates <oly.ya...@googlemail.com> wrote:

>
> Not sure this is the "best" way but try this:
> $(this).siblings().each(function(){
>    if($(this).attr("amount") > remaining){ $(this).attr("disabled",
> true) }
> });
> Hope this helps.
>
> On May 14, 5:31 am, Daniel Murker <dmur...@gmail.com> wrote:
> > 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