Form validation question

I have a Div with a class called "ss-item-required". In that div  I have some text boxes and radio buttons. I want to validate each set of radio buttons and input boxes. The radio button validation is working, but the text boxes are not validating. Below is the code I am using to check that the radio buttons are validated. Can someone help me add to this script so that any input boxes in the div with that name are also validated? Thank you.
 
        if ($('div.ss-item-required:not(:has(:radio:checked))').length > 0) {
    	alert("Make a selection");
    	return false;

Open in new window

earwig75Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Julian HansenCommented:
By validated do you mean has content?
Sample code below - full working source here
<script type="text/javascript">
$(function() {
  $('form').submit(function() {
   // Init error message 
    var msg = '';
    // Find all input's with the ss-item-required class
    $('input.ss-item-required').each(function() {
      // If empty add to error message using
      // placeholder text as label
      if ($(this).val() == '') {
        msg += $(this).attr('placeholder') + " is required\n";
      }
    });
    // Msg not empty - errors so show and return
    // false to prevent form submission
    if (msg !== '') {
      alert("Error: " + msg);
      return false;
    }
    // No errors - return  true so form can
    // be submitted
    return true;
  });
});
</script>

Open in new window

earwig75Author Commented:
This doesn't seem to work with a div class. Is it possible to just add to my existing validation? Basically a repeat of the line below checking for a checked radio button, but check that an input box in that DIV has content? I am not using labels or classes on the inputs.

Thanks again.

        if ($('div.ss-item-required:not(:has(:radio:checked))').length > 0) {
    	alert("Make a selection");
    	return false;

Open in new window

Julian HansenCommented:
This doesn't seem to work with a div class. Is it possible to just add to my existing validation?
Then just change
$('input.ss-item-required').each(function() {

Open in new window

to
$('div.ss-item-required input').each(function() {

Open in new window

Sample updated

NB: Labels were included for the sample

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
JavaScript

From novice to tech pro — start learning today.