Reputation: 1
I am trying to disable multiple fields in a checkbox survey at the same time. Is it possible to select by multiple classes on same the div? I tried below but its not working. The code works with one class.
function surveyInit(){
$("div[class*='addressLine1', class*='addressLine2'] input" ).attr('disabled', 'disabled');
}
Upvotes: 0
Views: 88
Reputation: 92
you need comma as seperator and you can youse dot to select class instead of attribute selector
function surveyInit(){
$("div.addressLine1 input,div.addressLine2 input" ).attr('disabled', 'disabled');
}
Upvotes: -2
Reputation: 780798
You need to use multiple selectors separated by commas, not put the commas inside the attribute selector.
function surveyInit(){
$("div[class*='addressLine1'] input, div[class*='addressLine2'] input").attr('disabled', 'disabled');
}
Upvotes: 6