if ( $("textarea:empty").length == 0 && $("input.title:empty").length == 0 ) {
$('.ask_question').attr('enabled', 'enabled');
}
Property length jQuery returns the number of elements that were selected. : empty is a jQuery selector for selecting elements that have no child or no text.
So,
if (number of empty textarea is 0) AND (number of empty input with the class title is 0) then
enable somthing!
source
share