Don't know if that's the best phrasing for the subject, but what I'm trying to do is develop some code that will work for all for inputs of type 'text', instead of hard-coding the id values.
The original code is this: $('input#street_number').blur(function() { if (this.value.length == 0) { $('#street-number-required-error').fadeIn(500); $('#submit').attr('disabled', 'disabled') } if (this.value.length > 0) { $('#street-number-required-error').fadeOut(500); $('#submit').attr('disabled', '') }; }); $('input#street_name').blur(function() { if (this.value.length == 0) { $('#street-name-required-error').fadeIn(500); $('#submit').attr('disabled', 'disabled') } if (this.value.length > 0) { $('#street-name-required-error').fadeOut(500); $('#submit').attr('disabled', '') }; }); Here's my coding attempt: (no errors in firebug, but not response from the DOM)... $(document).ready(function() { $("inp...@type='text']").each(function(i) { $(this).blur(function() { if (this.value.length == 0) { $(this.id.replace(/_/g, '-')+'-error').fadeIn(500); $('#submit').attr('disabled', 'disabled') } else { $(this.id.replace(/_/g, '-')+'-error').fadeOut(500); $('#submit').attr('disabled', '') } }); }); }); Anyone care to offer guidance to get this working? Thanks, Rick