FrenkyB FrenkyB - 1 year ago 86
Javascript Question

HTML search by two properties

I would like to be able to search for checkboxes which are not disabled (attribute

is not set to

My function is below. I am able to find all checkboxes, but I don't know how to search for not-disabled checkboxes:

MarkAllColumns = function () {

if (MarkAll === true) {
$("#tblArticlesSearch input[type=checkbox]").prop('checked', true);
else {
$("#tblArticlesSearch input[type=checkbox]").prop('checked', false);


I want to set attribute
to true only on not-disabled checkboxes.

Answer Source

You can either use :enabled selector or combine :not with :disabled selector

$("#tblArticlesSearch input[type=checkbox]:enabled")


$("#tblArticlesSearch input[type=checkbox]:not(:disabled)")
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download