I want to check a checkbox whose name and value I know, but I cannot use it this way. How can I select with 2 values?
$('[name="' + key + '" value="' + value[i] + '"]').attr('checked', true);
I want to check a checkbox whose name and value I know, but I cannot use it this way. How can I select with 2 values?
$('[name="' + key + '" value="' + value[i] + '"]').attr('checked', true);
Join your attribute selectors [][]
$(`[name="${key}"][value="${value[i]}"]`).prop({checked: true});
The above uses the more readable Template Literals instead of string concatenation using +