How can I get all radio buttons which are checked and value greater than 0 in jquery?

Viewed 34

I am including a check(if($(this).val() > 0) ) inside the loop which I want to eliminate and include that condition in the main statement?

$('#subtabs').find("input[type='radio'][id^='cf_']:checked")....

$('#subtabs').find("input[type='radio'][id^='cf_']:checked").each(function (index, value) {         
        if($(this).val() > 0) {
            .....           
            });
        }           
    });
1 Answers

Try this one, I hope will help you;

$('#subtabs').find("input[type='radio'][id^='cf_']:checked")
.each(function (index, value) {         
    // Only below line has changed. Use "value" variable instead of "this". Actually "value" is not a value, it is a tag element of selected list.
    if($(value).val() > 0) {
        // ...                       
    }           
});
Related