function checkRadio() { var rtn = ($('input.amount:checked').length > 0); $("#billing").css( { color : (rtn ? '#658300' : '#C60006') } ).show(); return rtn; };
On Nov 1, 2:57 pm, choffman <[EMAIL PROTECTED]> wrote: > Hi There, > I could use some jquery help here. This probably something very > simple that I'm missing. I started using jquery a few weeks ago so > please bear with me. > > In a nut shell, when a user submits the form (form id="register"), I > want it check to make sure they have selected a radio button > (class="amount"). If they forgot, I want it turn the #billing id (<h2 > id="billing>) red. I have server side validation working using PHP. > This is more of a visual indicator. I'm using the validate.js plug-in > and jquery 1.2.1. Any help would be great! > > $(document).ready(function() { > $("#register").submit( function() { > checkRadio(); > }); > > function checkRadio() { > $('input.amount').each(function() { > if ($('input:unchecked')) { > $("#billing").css('color', '#658300').show(); > return true; > } else { > $("#billing").css('color', '#C60006').show(); > return false; > } > }); > //close function > }; > > });