I've got this javascript/xuijs function:
function clearListBoxInputs(divelement,selected) {
x$(divelement).find("input").each(function(element, index, xui) {
x$(element).filter(function () {
return this.checked;
}).each(function (element, index, xui) {
element.checked = false;
});
});
}
selected contains this value "input#Q1793_QO5527". divelement contains this value: "div#divQ1793". element is each element (checkbox) inside "div#divQ1793": "input#Q1793_QO5527", "input#Q1793_QO5528","input#Q1793_QO5529",... What I want to do is uncheck all input elements inside "div#divQ1793" except the one specified on selected ("input#Q1793_QO5527"). How can I ignore this one?
Thanks
You can use
.not()to exclude a matching element.No need for all the
.eachand.filterloops, because.prop()automatically loops over all the elements.