Brandon Aaron schrieb:
You can use the filter method to select what you need. It would look
something like this:
$(document).ready(function() {
$('input[type=text]').filter(function() {
return !!$(this).val();
});
});
If you are using the validation plugin
(http://bassistance.de/jquery-plugins/jquery-plugin-validation/), you
can leverage the :blank selector - it filters all elements with no value
or only whitespace.
This is the implementation (also ":filled" and ":unchecked":
jQuery.extend(jQuery.expr[":"], {
blank: "!jQuery.trim(a.value)",
filled: "!!jQuery.trim(a.value)",
unchecked: "!a.checked"
});
Jörn