So if you want to check how many elements are found by your selector expression, You could use the length
property, which is defined on jQuery objects:
$('#dialog').on('show', function () {
var inputs = $('form#form_save_account input:visible');
if (inputs.length != 4) {
// Handle error
}
// Further work
}
If you also want to make sure that each input
element has a non-empty value, you could filter the inputs
variable before checking the length:
inputs = inputs.filter(function(i, input) {
return $(input).val().trim() != "";
});
You might also want to have a look at the jQuery form validation plugin, as it can automate such tasks:
http://docs.jquery.com/Plugins/Validation
Edit: Modified as I misunderstood your question in the beginning. Also added some more information.