If not disabled do this

jquery, math

Solution

Only iterate over the ones that aren't disabled:

$('.observationPositive:not(:disabled)').each(function() {
   // increment count
});

Problem

I am adding numbers entered into some inputs and getting a total. The totaling script works however now I want to not included the inputs to be counted if they are disabled. I am thinking I need to use :not(:disabled) but not sure how to put it into my script properly? This is the script that counts: ``` $('.observationPositive').each(function(){ countP++; sumP += Number($(this).val()); }); ``` How do I say only count if not disabled? (wrongly coded example) ``` $('.observationPositive').each(function(){ countP++; sumP += Number($(this:not(:disabled)).val()); }); ```

Original source