I want to select all the input
and select
with a class disabled
with out the property disabled. I will use this for validation purposes.
var disabled3 = $('#table').find('input,select').is(':not(:disabled)').hasClass('disabled');
tried above but not working
var disabled3 = false;
console.log(disabled3);
if ($('#table').find('input,select').is(':not(:disabled)')) {
disabled3 = $('#table').find('input,select').hasClass('disabled');
}
if (disabled3) {
alert('Missing somefields')
return false;
}
You can use
$('#table').find('input.disabled,select.disabled').not(":disabled" )
Also note that it will return a jquery object. Which means your if condition would be always true. Use length property to get the count of the objects and use that inside the if condition.
disabled3 = $('#table').find('input.disabled,select.disabled').not(":disabled" ).length;
if (length > 0) {
alert('Missing somefields')
return false;
}